From 55a9d204dbf0b6ae882d342fea5cc475e893591a Mon Sep 17 00:00:00 2001 From: Poorna Date: Fri, 6 Jan 2023 12:09:09 -0800 Subject: [PATCH] rb: avoid throwing error for force delete of prefix (#4436) --- cmd/rb-main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/rb-main.go b/cmd/rb-main.go index 8bf532be..44eafe29 100644 --- a/cmd/rb-main.go +++ b/cmd/rb-main.go @@ -199,6 +199,15 @@ func deleteBucket(ctx context.Context, url string, isForce bool) *probe.Error { return result.Err.Trace(url) } } + // Return early if prefix delete + switch c := clnt.(type) { + case *S3Client: + _, object := c.url2BucketAndObject() + if object != "" && isForce { + return nil + } + default: + } // Remove a bucket without force flag first because force // won't work if a bucket has some locking rules, that's