mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix: not return prefix object when list bucket object in non-recursive
mode
This commit is contained in:
@@ -200,9 +200,12 @@ func GetIObjects(bucket ICloudBucket, objectPrefix string, isRecursive bool) ([]
|
||||
}
|
||||
|
||||
// Send all objects
|
||||
if len(result.Objects) > 0 {
|
||||
ret = append(ret, result.Objects...)
|
||||
marker = result.Objects[len(result.Objects)-1].GetKey()
|
||||
for i := range result.Objects {
|
||||
if !isRecursive && result.Objects[i].GetKey() == objectPrefix {
|
||||
continue
|
||||
}
|
||||
ret = append(ret, result.Objects[i])
|
||||
marker = result.Objects[i].GetKey()
|
||||
}
|
||||
|
||||
// Send all common prefixes if any.
|
||||
|
||||
@@ -130,6 +130,9 @@ func (bucket *SBucket) GetIObjects(prefix string, isRecursive bool) ([]cloudprov
|
||||
if object.Err != nil {
|
||||
return nil, errors.Wrap(object.Err, "ListObjects")
|
||||
}
|
||||
if !isRecursive && prefix == object.Key {
|
||||
continue
|
||||
}
|
||||
obj := &SObject{
|
||||
bucket: bucket,
|
||||
SBaseCloudObject: cloudprovider.SBaseCloudObject{
|
||||
|
||||
Reference in New Issue
Block a user