minor fixes to mc share download command (#2106)

improved error messages and issue with `--recursive` option. 

Fixes  #2099
This commit is contained in:
Scott McClellan
2017-04-17 17:37:11 -07:00
committed by Harshavardhana
parent 1bf5ac350f
commit 9eb967cabf
2 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ func (e EmptyPath) Error() string {
type ObjectMissing struct{}
func (e ObjectMissing) Error() string {
return "Object key is missing, object key cannot be empty"
return "Object does not exist"
}
// UnexpectedShortWrite - write wrote less bytes than expected.
+9 -3
View File
@@ -89,9 +89,15 @@ func checkShareDownloadSyntax(ctx *cli.Context) {
fatalIf(errDummy().Trace(expiry.String()), "Expiry cannot be larger than 7 days.")
}
for _, url := range ctx.Args() {
_, _, err := url2Stat(url)
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
// Validate if object exists only if the `--recursive` option was NOT specified
isRecursive := ctx.Bool("recursive")
if !isRecursive {
for _, url := range ctx.Args() {
_, _, err := url2Stat(url)
if err != nil {
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
}
}
}
}