MCPcopy Index your code
hub / github.com/peak/s5cmd / prepareRemoteDestination

Function prepareRemoteDestination

command/cp.go:910–925  ·  view source on GitHub ↗

prepareRemoteDestination will return a new destination URL for remote->remote and local->remote copy operations.

(
	srcurl *url.URL,
	dsturl *url.URL,
	flatten bool,
	isBatch bool,
)

Source from the content-addressed store, hash-verified

908// prepareRemoteDestination will return a new destination URL for
909// remote->remote and local->remote copy operations.
910func prepareRemoteDestination(
911 srcurl *url.URL,
912 dsturl *url.URL,
913 flatten bool,
914 isBatch bool,
915) *url.URL {
916 objname := srcurl.Base()
917 if isBatch && !flatten {
918 objname = srcurl.Relative()
919 }
920
921 if dsturl.IsPrefix() || dsturl.IsBucket() {
922 dsturl = dsturl.Join(objname)
923 }
924 return dsturl
925}
926
927// prepareDownloadDestination will return a new destination URL for
928// remote->local copy operations.

Callers 2

prepareCopyTaskMethod · 0.85
prepareUploadTaskMethod · 0.85

Calls 5

BaseMethod · 0.80
RelativeMethod · 0.80
IsPrefixMethod · 0.80
IsBucketMethod · 0.80
JoinMethod · 0.80

Tested by

no test coverage detected