Source and Destination can not be same

This commit is contained in:
Krishna Srinivas
2015-11-17 18:27:42 -08:00
parent 3eda3bfd44
commit 43eda0e93f
2 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -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)}}
}
+4
View File
@@ -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()
}
)