Skip to content

Commit

Permalink
fix(storage): resolve relative path from cwd (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge authored Mar 26, 2024
1 parent 9d9d228 commit d98aab5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/storage/cp/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d98aab5

Please sign in to comment.