Merge pull request #1521 from harshavardhana/is-complete
incomplete-upload: Listing should handle incomplete upload prefixes a…
This commit is contained in:
+3
-1
@@ -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
@@ -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
@@ -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+"’.")
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user