From 9eb967cabfc9f71a463192e321ae333509ec1e15 Mon Sep 17 00:00:00 2001 From: Scott McClellan Date: Mon, 17 Apr 2017 17:37:11 -0700 Subject: [PATCH] minor fixes to `mc share download` command (#2106) improved error messages and issue with `--recursive` option. Fixes #2099 --- cmd/client-errors.go | 2 +- cmd/share-download-main.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/client-errors.go b/cmd/client-errors.go index 2a22f2a3..bc7b5f42 100644 --- a/cmd/client-errors.go +++ b/cmd/client-errors.go @@ -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. diff --git a/cmd/share-download-main.go b/cmd/share-download-main.go index e25b1fd8..c6f3105f 100644 --- a/cmd/share-download-main.go +++ b/cmd/share-download-main.go @@ -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+"`.") + } + } } }