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 and SandyXSD committed Feb 3, 2024
1 parent a9c631a commit 53f4731
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/object/obs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import (
"os"
"strings"

"github.com/pkg/errors"

"github.com/huaweicloud/huaweicloud-sdk-go-obs/obs"
"github.com/juicedata/juicefs/pkg/utils"
"golang.org/x/net/http/httpproxy"
Expand Down Expand Up @@ -182,12 +180,9 @@ func (s *obsClient) List(prefix, marker string, limit int64) ([]Object, error) {
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, "/")}
objs[i] = &obj{o.Key, o.Size, o.LastModified, strings.HasSuffix(o.Key, "/")}
}
return objs, nil
}
Expand Down

0 comments on commit 53f4731

Please sign in to comment.