Skip to content

Commit

Permalink
object/obs: don't decode the object key in list result (#4331)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro authored Jan 10, 2024
1 parent 77ce951 commit 113c836
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/object/obs.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,9 @@ func (s *obsClient) List(prefix, marker, delimiter string, limit int64, followLi
n := len(resp.Contents)
objs := make([]Object, n)
for i := 0; i < n; i++ {
// Obs SDK listObjects method already decodes the object key.
o := resp.Contents[i]
key, err := obs.UrlDecode(o.Key)
if err != nil {
return nil, errors.WithMessagef(err, "failed to decode key %s", o.Key)
}
objs[i] = &obj{key, o.Size, o.LastModified, strings.HasSuffix(key, "/"), string(o.StorageClass)}
objs[i] = &obj{o.Key, o.Size, o.LastModified, strings.HasSuffix(o.Key, "/"), string(o.StorageClass)}
}
if delimiter != "" {
for _, p := range resp.CommonPrefixes {
Expand Down

0 comments on commit 113c836

Please sign in to comment.