Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

s3: fix single file copying behavior with low permission - Fixes #8975

hunshcn6440052fbdb5
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index c2c3392dd..c9ebca82f 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -1648,11 +1648,14 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
newRoot, leaf := path.Split(oldRoot)
f.setRoot(newRoot)
_, err := f.NewObject(ctx, leaf)
- if err != nil {
+ if errors.Is(err, fs.ErrorObjectNotFound) {
// File doesn't exist or is a directory so return old f
f.setRoot(oldRoot)
return f, nil
}
+ if err != nil {
+ return nil, err
+ }
// return an error with an fs which points to the parent
return f, fs.ErrorIsFile
}