diff --git a/internal/storage/cp/cp.go b/internal/storage/cp/cp.go index f05a68d87..09d6d5175 100644 --- a/internal/storage/cp/cp.go +++ b/internal/storage/cp/cp.go @@ -35,13 +35,21 @@ func Run(ctx context.Context, src, dst string, recursive bool, maxJobs uint, fsy return err } if strings.ToLower(srcParsed.Scheme) == storage.STORAGE_SCHEME && dstParsed.Scheme == "" { + localPath := dst + if !filepath.IsAbs(dst) { + localPath = filepath.Join(utils.CurrentDirAbs, dst) + } if recursive { - return DownloadStorageObjectAll(ctx, projectRef, srcParsed.Path, dst, maxJobs, fsys) + return DownloadStorageObjectAll(ctx, projectRef, srcParsed.Path, localPath, maxJobs, fsys) } - return client.DownloadStorageObject(ctx, projectRef, srcParsed.Path, dst, fsys) + return client.DownloadStorageObject(ctx, projectRef, srcParsed.Path, localPath, fsys) } else if srcParsed.Scheme == "" && strings.ToLower(dstParsed.Scheme) == storage.STORAGE_SCHEME { + localPath := src + if !filepath.IsAbs(localPath) { + localPath = filepath.Join(utils.CurrentDirAbs, localPath) + } if recursive { - return UploadStorageObjectAll(ctx, projectRef, dstParsed.Path, src, maxJobs, fsys, opts...) + return UploadStorageObjectAll(ctx, projectRef, dstParsed.Path, localPath, maxJobs, fsys, opts...) } return client.UploadStorageObject(ctx, projectRef, dstParsed.Path, src, fsys, opts...) } else if strings.ToLower(srcParsed.Scheme) == storage.STORAGE_SCHEME && strings.ToLower(dstParsed.Scheme) == storage.STORAGE_SCHEME {