mirror of
https://github.com/versity/versitygw.git
synced 2026-09-25 09:24:22 +00:00
fix: azure list objects trim common prefixes that match marker prefix
This commit is contained in:
@@ -3605,12 +3605,12 @@ func ListObjects_paginated(s *S3Conf) error {
|
||||
|
||||
expected := []string{"dir1/subdir.ext", "dir1/subdir1.ext", "dir1/subdir2.ext"}
|
||||
if !hasObjNames(objs, expected) {
|
||||
return fmt.Errorf("expected objects %v, instead got %v", expected, objs)
|
||||
return fmt.Errorf("expected objects %v, instead got %v", expected, objStrings(objs))
|
||||
}
|
||||
|
||||
expectedPrefix := []string{"dir1/subdir/"}
|
||||
if !hasPrefixName(prefixes, expectedPrefix) {
|
||||
return fmt.Errorf("expected prefixes %v, instead got %v", expectedPrefix, prefixes)
|
||||
return fmt.Errorf("expected prefixes %v, instead got %v", expectedPrefix, pfxStrings(prefixes))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -844,3 +844,19 @@ func checkWORMProtection(client *s3.Client, bucket, object string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func objStrings(objs []types.Object) []string {
|
||||
objStrs := make([]string, len(objs))
|
||||
for i, obj := range objs {
|
||||
objStrs[i] = *obj.Key
|
||||
}
|
||||
return objStrs
|
||||
}
|
||||
|
||||
func pfxStrings(pfxs []types.CommonPrefix) []string {
|
||||
pfxStrs := make([]string, len(pfxs))
|
||||
for i, pfx := range pfxs {
|
||||
pfxStrs[i] = *pfx.Prefix
|
||||
}
|
||||
return pfxStrs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user