From 735aa139b19cef6d7c2e4cb56afc76bb4625707e Mon Sep 17 00:00:00 2001 From: poornas Date: Fri, 11 Oct 2019 21:19:14 -0700 Subject: [PATCH] Fix removing empty prefixes with `mc rm ` command (#2912) Fixes: 2909 --- cmd/rm-main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/rm-main.go b/cmd/rm-main.go index c6aaaf57..e0ca3ad2 100644 --- a/cmd/rm-main.go +++ b/cmd/rm-main.go @@ -21,6 +21,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "github.com/fatih/color" "github.com/minio/cli" @@ -218,6 +219,9 @@ func removeSingle(url string, isIncomplete bool, isFake, isForce bool, olderThan errorIf(pErr.Trace(url), "Invalid argument `"+url+"`.") return exitStatus(globalErrorExitStatus) // End of journey. } + if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) && content.Type.IsDir() { + targetURL = targetURL + string(clnt.GetURL().Separator) + } contentCh := make(chan *clientContent, 1) contentCh <- &clientContent{URL: *newClientURL(targetURL)}