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 purging of root directory with --s3-directory-markers - fixes #7247

Nick Craig-Woodb95bda1e921f
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index 18171904e..a925a8d21 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -4833,6 +4833,10 @@ func (f *Fs) purge(ctx context.Context, dir string, oldOnly bool) error {
if isDirectory {
return nil
}
+ // If the root is a dirmarker it will have lost its trailing /
+ if remote == "" {
+ remote = "/"
+ }
oi, err := f.newObjectWithInfo(ctx, remote, object, versionID)
if err != nil {
fs.Errorf(object, "Can't create object %+v", err)