Merge pull request #939 from harshavardhana/pr_out_check_for_url_s_when_target_path_doesn_t_have_bucket_error_out_quickly
Check for url's when target path doesn't have bucket, error out quickly
This commit is contained in:
+12
@@ -85,6 +85,18 @@ func checkCastSyntax(ctx *cli.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
for _, tgtURL := range tgtURLs {
|
||||
url, err := client.Parse(tgtURL)
|
||||
if err != nil {
|
||||
console.Fatalf("Unable to parse target ‘%s’ argument. %s\n", tgtURL, NewIodine(iodine.New(err, nil)))
|
||||
}
|
||||
if url.Host != "" {
|
||||
if url.Path == string(url.Separator) {
|
||||
console.Fatalf("Bucket creation detected for %s, cloud storage URL's should use ‘mc mb’ to create buckets\n", tgtURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch guessCastURLType(srcURL, tgtURLs) {
|
||||
case castURLsTypeA: // File -> File.
|
||||
checkCastSyntaxTypeA(srcURL, tgtURLs)
|
||||
|
||||
@@ -75,6 +75,15 @@ func checkCopySyntax(ctx *cli.Context) {
|
||||
if isURLRecursive(tgtURL) {
|
||||
console.Fatalf("Recursive option is not supported for target ‘%s’ argument. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil)))
|
||||
}
|
||||
url, err := client.Parse(tgtURL)
|
||||
if err != nil {
|
||||
console.Fatalf("Unable to parse target ‘%s’ argument. %s\n", tgtURL, NewIodine(iodine.New(err, nil)))
|
||||
}
|
||||
if url.Host != "" {
|
||||
if url.Path == string(url.Separator) {
|
||||
console.Fatalf("Bucket creation detected for %s, cloud storage URL's should use ‘mc mb’ to create buckets\n", tgtURL)
|
||||
}
|
||||
}
|
||||
switch guessCopyURLType(srcURLs, tgtURL) {
|
||||
case copyURLsTypeA: // File -> File.
|
||||
checkCopySyntaxTypeA(srcURLs, tgtURL)
|
||||
|
||||
Reference in New Issue
Block a user