From 8f3d514e3bf89145b7bb3d1a6d889648d6532410 Mon Sep 17 00:00:00 2001 From: poornas Date: Mon, 29 Jun 2020 20:33:31 -0700 Subject: [PATCH] Fix `mc cp` regression for recursive copy (#3278) Fixes #3267. Revert commit dc430afe07f5ce09b06055477cc5370e50e2f45b which attempted to preserve similar behavior across mc cp and mc mirror, but introduces a regression for cp when wildcards are specified. --- cmd/cp-url.go | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/cmd/cp-url.go b/cmd/cp-url.go index d2733a3f..f9d88e96 100644 --- a/cmd/cp-url.go +++ b/cmd/cp-url.go @@ -18,7 +18,6 @@ package cmd import ( "context" - "os" "path/filepath" "strings" @@ -193,18 +192,6 @@ func makeCopyContentTypeC(sourceAlias string, sourceURL ClientURL, sourceContent newSourceSuffix := filepath.ToSlash(newSourceURL.Path) if pathSeparatorIndex > 1 { sourcePrefix := filepath.ToSlash(sourceURL.Path[:pathSeparatorIndex]) - // do not preserve unix cp behavior when copying a filesytem dir to - // objectstore. - if sourceAlias == "" && targetAlias != "" { - // Check if sourceURL.Path is a directory or not - fileInfo, err := os.Stat(sourceURL.Path) - if err != nil { - return URLs{Error: probe.NewError(err)} - } - if fileInfo.IsDir() { - sourcePrefix = filepath.ToSlash(sourceURL.Path) - } - } newSourceSuffix = strings.TrimPrefix(newSourceSuffix, sourcePrefix) } newTargetURL := urlJoinPath(targetURL, newSourceSuffix)