Source and Destination can not be same
This commit is contained in:
@@ -224,7 +224,10 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) copyURLs {
|
||||
// Source is not a regular file
|
||||
return copyURLs{Error: errInvalidSource(sourceURL).Trace()}
|
||||
}
|
||||
|
||||
if sourceURL == targetURL {
|
||||
// source and target can not be same
|
||||
return copyURLs{Error: errSourceTargetSame(sourceURL).Trace()}
|
||||
}
|
||||
// All OK.. We can proceed. Type A
|
||||
return copyURLs{SourceContent: sourceContent, TargetContent: &client.Content{URL: *client.NewURL(targetURL)}}
|
||||
}
|
||||
|
||||
@@ -66,4 +66,8 @@ var (
|
||||
errSourceIsDir = func(URL string) *probe.Error {
|
||||
return probe.NewError(errors.New("Source ‘" + URL + "’ is a folder.")).Untrace()
|
||||
}
|
||||
|
||||
errSourceTargetSame = func(URL string) *probe.Error {
|
||||
return probe.NewError(errors.New("Source and target URL can not be same : " + URL)).Untrace()
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user