aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorannluda <anluda@foxmail.com>2023-09-12 11:06:12 +0800
committerChris Lu <chrislusf@users.noreply.github.com>2023-09-11 21:35:15 -0700
commit8908810376e671b34262295f1ad558ca43db58c2 (patch)
tree6380515b251becd0e0b5064a51443b6cd5f03d13
parent9b666a53ed4f8dd266e56bb415ad98818356363d (diff)
downloadseaweedfs-8908810376e671b34262295f1ad558ca43db58c2.tar.xz
seaweedfs-8908810376e671b34262295f1ad558ca43db58c2.zip
Fix s3 api object list with params max-keys and prefix
-rw-r--r--weed/filer/filerstore_wrapper.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/weed/filer/filerstore_wrapper.go b/weed/filer/filerstore_wrapper.go
index 0fac6a138..0eecdd6cb 100644
--- a/weed/filer/filerstore_wrapper.go
+++ b/weed/filer/filerstore_wrapper.go
@@ -292,10 +292,8 @@ func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath u
count := int64(0)
for count < limit && len(notPrefixed) > 0 {
- var isLastItemHasPrefix bool
for _, entry := range notPrefixed {
if strings.HasPrefix(entry.Name(), prefix) {
- isLastItemHasPrefix = true
count++
if !eachEntryFunc(entry) {
return
@@ -303,11 +301,9 @@ func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath u
if count >= limit {
break
}
- } else {
- isLastItemHasPrefix = false
}
}
- if count < limit && isLastItemHasPrefix && len(notPrefixed) == int(limit) {
+ if count < limit && lastFileName <= prefix && len(notPrefixed) == int(limit) {
notPrefixed = notPrefixed[:0]
lastFileName, err = actualStore.ListDirectoryEntries(ctx, dirPath, lastFileName, false, limit, func(entry *Entry) bool {
notPrefixed = append(notPrefixed, entry)