From c0cda087a8368ed695c28eb6f313786d6be95d16 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 7 Feb 2021 17:18:52 +0000 Subject: [PATCH] s3: don't check to see if remote is object if it ends with / Before this change, rclone would always check the root to see if it was an object. This change doesn't check to see if the root is an object if the path ends with a / This avoids a transaction where rclone HEADs the path to see if it exists. See #4990 --- backend/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 9aea35c18..ccdeebf14 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1693,7 +1693,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e GetTier: true, SlowModTime: true, }).Fill(ctx, f) - if f.rootBucket != "" && f.rootDirectory != "" && !opt.NoHeadObject { + if f.rootBucket != "" && f.rootDirectory != "" && !opt.NoHeadObject && !strings.HasSuffix(root, "/") { // Check to see if the (bucket,directory) is actually an existing file oldRoot := f.root newRoot, leaf := path.Split(oldRoot)