aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-07-27 03:32:24 -0700
committerChris Lu <chris.lu@gmail.com>2021-07-27 03:32:24 -0700
commit035b0bae2982921f4de158308103f9e893ee9cc2 (patch)
tree0630cbfcb97baa49f639c42952f13aa71275e4ae
parent1752eeb53803736f72d85d35f504997744288716 (diff)
downloadseaweedfs-035b0bae2982921f4de158308103f9e893ee9cc2.tar.xz
seaweedfs-035b0bae2982921f4de158308103f9e893ee9cc2.zip
refactor
-rw-r--r--weed/remote_storage/s3/s3_storage_client.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/remote_storage/s3/s3_storage_client.go b/weed/remote_storage/s3/s3_storage_client.go
index 99fa21515..f994eb69f 100644
--- a/weed/remote_storage/s3/s3_storage_client.go
+++ b/weed/remote_storage/s3/s3_storage_client.go
@@ -47,6 +47,7 @@ type s3RemoteStorageClient struct {
func (s s3RemoteStorageClient) Traverse(remote remote_storage.RemoteStorageLocation, visitFn remote_storage.VisitFunc) (err error) {
_, bucket, pathKey := remote.NameBucketPath()
+ pathKey = pathKey[1:]
listInput := &s3.ListObjectsV2Input{
Bucket: aws.String(bucket),
@@ -56,7 +57,7 @@ func (s s3RemoteStorageClient) Traverse(remote remote_storage.RemoteStorageLocat
ExpectedBucketOwner: nil,
FetchOwner: nil,
MaxKeys: nil, // aws.Int64(1000),
- Prefix: aws.String(pathKey[1:]),
+ Prefix: aws.String(pathKey),
RequestPayer: nil,
StartAfter: nil,
}
@@ -65,10 +66,10 @@ func (s s3RemoteStorageClient) Traverse(remote remote_storage.RemoteStorageLocat
listErr := s.conn.ListObjectsV2Pages(listInput, func(page *s3.ListObjectsV2Output, lastPage bool) bool {
for _, content := range page.Contents {
key := (*content.Key)
- if len(pathKey) == 1 {
+ if len(pathKey) == 0 {
key = "/" + key
} else {
- key = key[len(pathKey)-1:]
+ key = key[len(pathKey):]
}
dir, name := util.FullPath(key).DirAndName()
if err := visitFn(dir, name, false, &filer_pb.RemoteEntry{