"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
s3: fix encoding for control characters - Fixes #3345
Nick Craig-Wooda8adce9c59bb
diff --git a/backend/s3/s3.go b/backend/s3/s3.goindex dbc6f72af..11d84ece1 100644--- a/backend/s3/s3.go+++ b/backend/s3/s3.go@@ -20,6 +20,7 @@ import ("fmt""io""net/http"+ "net/url""path""regexp""strings"@@ -1221,11 +1222,12 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuckfor {// FIXME need to implement ALL loopreq := s3.ListObjectsInput{- Bucket: &bucket,- Delimiter: &delimiter,- Prefix: &directory,- MaxKeys: &maxKeys,- Marker: marker,+ Bucket: &bucket,+ Delimiter: &delimiter,+ Prefix: &directory,+ MaxKeys: &maxKeys,+ Marker: marker,+ EncodingType: aws.String(s3.EncodingTypeUrl),}var resp *s3.ListObjectsOutputvar err error@@ -1259,6 +1261,11 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuckcontinue}remote := *commonPrefix.Prefix+ remote, err = url.QueryUnescape(remote)+ if err != nil {+ fs.Logf(f, "failed to URL decode %q in listing common prefix: %v", *commonPrefix.Prefix, err)+ continue+ }if !strings.HasPrefix(remote, prefix) {fs.Logf(f, "Odd name received %q", remote)continue@@ -1278,6 +1285,11 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck}for _, object := range resp.Contents {remote := aws.StringValue(object.Key)+ remote, err = url.QueryUnescape(remote)+ if err != nil {+ fs.Logf(f, "failed to URL decode %q in listing: %v", aws.StringValue(object.Key), err)+ continue+ }if !strings.HasPrefix(remote, prefix) {fs.Logf(f, "Odd name received %q", remote)continue