From 2412aae68f364e8746bb95ef5f1a574eda7e35d0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 26 Nov 2016 22:56:02 -0800 Subject: [PATCH] cp/mirror: Use proper paths for windows during copyObject. (#1897) Fixes #1857 --- cmd/cp-main.go | 3 ++- cmd/mirror-main.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/cp-main.go b/cmd/cp-main.go index 42c47428..a222abeb 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -183,7 +183,8 @@ func doCopy(cpURLs URLs, progressReader *progressBar, accountingReader *accounte // If source/target are object storage their aliases must be the same. if sourceAlias == targetAlias { // Do not include alias inside path for ObjStore -> ObjStore. - err := copySourceStreamFromAlias(targetAlias, targetURL.String(), sourceURL.Path, length, progress) + sourcePath := filepath.ToSlash(sourceURL.Path) + err := copySourceStreamFromAlias(targetAlias, targetURL.String(), sourcePath, length, progress) if err != nil { cpURLs.Error = err.Trace(sourceURL.String()) return cpURLs diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 496326e8..d0566da2 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -246,7 +246,8 @@ func (ms *mirrorSession) doMirror(sURLs URLs) URLs { if sourceAlias == targetAlias { // If source/target are object storage their aliases must be the same // Do not include alias inside path for ObjStore -> ObjStore. - err := copySourceStreamFromAlias(targetAlias, targetURL.String(), sourceURL.Path, length, ms.status) + sourcePath := filepath.ToSlash(sourceURL.Path) + err := copySourceStreamFromAlias(targetAlias, targetURL.String(), sourcePath, length, ms.status) if err != nil { return sURLs.WithError(err.Trace(sourceURL.String())) }