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. 3
      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 (
"bytes"
"fmt"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"io"
"net/http"
"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
if len(originalMarker) > 0 && originalMarker[0:1] != "/" {
marker = getStartFileFromKey(originalMarker)
marker = s3a.getStartFileFromKey(originalMarker)
} else {
marker = originalMarker
}
@ -163,7 +163,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
Name: bucket,
Prefix: originalPrefix,
Marker: originalMarker,
MaxKeys: maxKeys,
MaxKeys: int(maxKeys),
Delimiter: delimiter,
}
if encodingTypeUrl {
@ -183,7 +183,7 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
defer func() {
if cursor.maxKeys == 0 {
cursor.isTruncated = true
cursor.nextMarker = getStartFileFromKey(key)
cursor.nextMarker = s3a.getStartFileFromKey(key)
}
}()
if delimiter == "/" {

3
weed/s3api/s3api_object_handlers_list_test.go

@ -27,8 +27,7 @@ func TestListObjectsHandler(t *testing.T) {
ETag: "\"4397da7a7649e8085de9916c240e8166\"",
Size: 1234567,
Owner: CanonicalUser{
ID: "65a011niqo39cdf8ec533ec3d1ccaafsa932",
set: true,
ID: "65a011niqo39cdf8ec533ec3d1ccaafsa932",
},
StorageClass: "STANDARD",
}},

11
weed/s3api/s3api_xsd_generated.go

@ -1125,9 +1125,8 @@ type ListBucketResult struct {
Prefix string `xml:"Prefix"`
Marker string `xml:"Marker"`
NextMarker string `xml:"NextMarker,omitempty"`
MaxKeys uint16 `xml:"MaxKeys"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter,omitempty"`
EncodingType string `xml:"EncodingType,omitempty"`
IsTruncated bool `xml:"IsTruncated"`
Contents []ListEntry `xml:"Contents,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)
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 {
type T ListEntry
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
for {
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
if fnErr := fn(entry); fnErr != nil {
err = fnErr

Loading…
Cancel
Save