From 50669cafa6ebd2f27e8491f0e25f8d792009f659 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 10 Jun 2022 15:12:16 -0700 Subject: [PATCH] ignore remove errors for WORM protected objects (#4111) this error is similar to insufficient permission on local folders, we can proceed to remove whatever objects we can. --- cmd/rm-main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/rm-main.go b/cmd/rm-main.go index 8ee61f73..742fbb38 100644 --- a/cmd/rm-main.go +++ b/cmd/rm-main.go @@ -536,10 +536,14 @@ func listAndRemove(url string, opts removeOpts) error { if result.Err != nil { errorIf(result.Err.Trace(path), "Failed to remove `"+path+"`.") - switch result.Err.ToGoError().(type) { + switch e := result.Err.ToGoError().(type) { case PathInsufficientPermission: // Ignore Permission error. continue + case minio.ErrorResponse: + if strings.Contains(e.Message, "Object is WORM protected and cannot be overwritten") { + continue + } } close(contentCh) return exitStatus(globalErrorExitStatus)