Browse Source

fix merged to master

pull/5580/head
Konstantin Lebedev 6 months ago
parent
commit
92e7a85adf
  1. 2
      weed/s3api/s3api_object_handlers.go
  2. 6
      weed/s3api/s3api_object_handlers_list.go
  3. 1
      weed/s3api/s3api_object_handlers_list_test.go
  4. 11
      weed/s3api/s3api_xsd_generated.go
  5. 2
      weed/server/filer_grpc_server_traverse_meta.go

2
weed/s3api/s3api_object_handlers.go

@ -3,6 +3,8 @@ package s3api
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"io" "io"
"net/http" "net/http"
"net/url" "net/url"

6
weed/s3api/s3api_object_handlers_list.go

@ -155,7 +155,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
} }
// This is necessary for SQL request with WHERE `directory` || `name` > originalMarker // This is necessary for SQL request with WHERE `directory` || `name` > originalMarker
if len(originalMarker) > 0 && originalMarker[0:1] != "/" { if len(originalMarker) > 0 && originalMarker[0:1] != "/" {
marker = getStartFileFromKey(originalMarker)
marker = s3a.getStartFileFromKey(originalMarker)
} else { } else {
marker = originalMarker marker = originalMarker
} }
@ -163,7 +163,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
Name: bucket, Name: bucket,
Prefix: originalPrefix, Prefix: originalPrefix,
Marker: originalMarker, Marker: originalMarker,
MaxKeys: maxKeys,
MaxKeys: int(maxKeys),
Delimiter: delimiter, Delimiter: delimiter,
} }
if encodingTypeUrl { if encodingTypeUrl {
@ -183,7 +183,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
defer func() { defer func() {
if cursor.maxKeys == 0 { if cursor.maxKeys == 0 {
cursor.isTruncated = true cursor.isTruncated = true
cursor.nextMarker = getStartFileFromKey(key)
cursor.nextMarker = s3a.getStartFileFromKey(key)
} }
}() }()
if delimiter == "/" { if delimiter == "/" {

1
weed/s3api/s3api_object_handlers_list_test.go

@ -28,7 +28,6 @@ func TestListObjectsHandler(t *testing.T) {
Size: 1234567, Size: 1234567,
Owner: CanonicalUser{ Owner: CanonicalUser{
ID: "65a011niqo39cdf8ec533ec3d1ccaafsa932", ID: "65a011niqo39cdf8ec533ec3d1ccaafsa932",
set: true,
}, },
StorageClass: "STANDARD", StorageClass: "STANDARD",
}}, }},

11
weed/s3api/s3api_xsd_generated.go

@ -1125,9 +1125,8 @@ type ListBucketResult struct {
Prefix string `xml:"Prefix"` Prefix string `xml:"Prefix"`
Marker string `xml:"Marker"` Marker string `xml:"Marker"`
NextMarker string `xml:"NextMarker,omitempty"` NextMarker string `xml:"NextMarker,omitempty"`
MaxKeys uint16 `xml:"MaxKeys"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter,omitempty"` Delimiter string `xml:"Delimiter,omitempty"`
EncodingType string `xml:"EncodingType,omitempty"`
IsTruncated bool `xml:"IsTruncated"` IsTruncated bool `xml:"IsTruncated"`
Contents []ListEntry `xml:"Contents,omitempty"` Contents []ListEntry `xml:"Contents,omitempty"`
CommonPrefixes []PrefixEntry `xml:"CommonPrefixes,omitempty"` CommonPrefixes []PrefixEntry `xml:"CommonPrefixes,omitempty"`
@ -1153,14 +1152,6 @@ func (t *ListEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
layout.LastModified = (*xsdDateTime)(&layout.T.LastModified) layout.LastModified = (*xsdDateTime)(&layout.T.LastModified)
return e.EncodeElement(layout, start) return e.EncodeElement(layout, start)
} }
func (c CanonicalUser) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if !c.set {
return nil
}
type canonicalUserWrapper CanonicalUser
return e.EncodeElement(canonicalUserWrapper(c), start)
}
func (t *ListEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { func (t *ListEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
type T ListEntry type T ListEntry
var overlay struct { var overlay struct {

2
weed/server/filer_grpc_server_traverse_meta.go

@ -63,7 +63,7 @@ func (fs *FilerServer) iterateDirectory(ctx context.Context, dirPath util.FullPa
var listErr error var listErr error
for { for {
var hasEntries bool var hasEntries bool
lastFileName, listErr = fs.filer.StreamListDirectoryEntries(ctx, dirPath, lastFileName, false, 1024, "", "", "", func(entry *filer.Entry) bool {
lastFileName, listErr = fs.filer.StreamListDirectoryEntries(ctx, dirPath, lastFileName, false, false, false, 1024, "", "", "", func(entry *filer.Entry) bool {
hasEntries = true hasEntries = true
if fnErr := fn(entry); fnErr != nil { if fnErr := fn(entry); fnErr != nil {
err = fnErr err = fnErr

Loading…
Cancel
Save