Merge pull request #1521 from harshavardhana/is-complete

incomplete-upload: Listing should handle incomplete upload prefixes a…
This commit is contained in:
Harshavardhana
2015-12-02 10:40:06 -08:00
4 changed files with 11 additions and 5 deletions
+3 -1
View File
@@ -114,7 +114,9 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool) {
srcURL := srcURLs[0]
_, srcContent, err := url2Stat(srcURL)
if err != nil && !isURLPrefixExists(srcURL) {
// incomplete uploads are not necessary for copy operation, no need to verify for them.
isIncomplete := false
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
fatalIf(err.Trace(srcURL), "Unable to stat source ‘"+srcURL+"’.")
}
+3 -1
View File
@@ -95,9 +95,11 @@ func checkListSyntax(ctx *cli.Context) {
URLs, err := args2URLs(ctx.Args())
fatalIf(err.Trace(ctx.Args()...), fmt.Sprintf("One or more unknown URL types passed."))
isIncomplete := ctx.Bool("incomplete")
for _, url := range URLs {
_, _, err := url2Stat(url)
if err != nil && !isURLPrefixExists(url) {
if err != nil && !isURLPrefixExists(url, isIncomplete) {
fatalIf(err.Trace(url), "Unable to stat ‘"+url+"’.")
}
}
+3 -1
View File
@@ -61,7 +61,9 @@ func checkMirrorSyntax(ctx *cli.Context) {
/****** Generic rules *******/
_, srcContent, err := url2Stat(srcURL)
if err != nil && !isURLPrefixExists(srcURL) {
// incomplete uploads are not necessary for copy operation, no need to verify for them.
isIncomplete := false
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
fatalIf(err.Trace(srcURL), "Unable to stat source ‘"+srcURL+"’.")
}
+2 -2
View File
@@ -77,13 +77,13 @@ func url2Stat(urlStr string) (client client.Client, content *client.Content, err
}
// isURLPrefixExists - check if object key prefix exists.
func isURLPrefixExists(urlPrefix string) bool {
func isURLPrefixExists(urlPrefix string, incomplete bool) bool {
clnt, err := url2Client(urlPrefix)
if err != nil {
return false
}
isRecursive := true
isIncomplete := false
isIncomplete := incomplete
for entry := range clnt.List(isRecursive, isIncomplete) {
if entry.Err != nil {
return false