Skip to content

Commit

Permalink
mc share download clean up; --recursive option and error messages (
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott McClellan committed Apr 14, 2017
1 parent 3c0094a commit f4bd165
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/client-errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 9 additions & 3 deletions cmd/share-download-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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+"`.")
}
}
}
}

Expand Down

0 comments on commit f4bd165

Please sign in to comment.