From 801a820c542cb7661c4fe73199ca498d0d471cc0 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 21 Aug 2020 13:28:08 +0100 Subject: [PATCH] s3: fix detection of bucket existing This reverts part of 151f03378f s3: fix upload of single files into buckets without create permission This erroneously assumed that a HEAD request on a non existent object would return "NotFound" if the bucket was found. In fact it returns "NotFound" when the bucket isn't found also. This will break the fix for #4297 - however that can be made to work using the new --s3-assume-bucket-exists flag --- backend/s3/s3.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 10b0bc525..6e69006e3 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -2446,11 +2446,6 @@ func (o *Object) readMetaData(ctx context.Context) (err error) { if err != nil { if awsErr, ok := err.(awserr.RequestFailure); ok { if awsErr.StatusCode() == http.StatusNotFound { - // NotFound indicates bucket was OK - // NoSuchBucket would be returned if bucket was bad - if awsErr.Code() == "NotFound" { - o.fs.cache.MarkOK(bucket) - } return fs.ErrorObjectNotFound } }