do not stat on url prepration. disable force flag
This commit is contained in:
@@ -177,10 +177,13 @@ func prepareSingleCastURLsTypeA(sourceURL string, targetURL string) castURLs {
|
||||
if !sourceContent.Type.IsRegular() { // Source is not a regular file
|
||||
return castURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))}
|
||||
}
|
||||
|
||||
/* // Too expensive. Lets ignore it for now.
|
||||
targetClient, err := target2Client(targetURL)
|
||||
if err != nil {
|
||||
return castURLs{Error: NewIodine(iodine.New(err, nil))}
|
||||
}
|
||||
|
||||
// Target exists?
|
||||
targetContent, err := targetClient.Stat()
|
||||
if err == nil { // Target exists.
|
||||
@@ -191,6 +194,7 @@ func prepareSingleCastURLsTypeA(sourceURL string, targetURL string) castURLs {
|
||||
targetContents = append(targetContents, targetContent)
|
||||
return castURLs{SourceContent: sourceContent, TargetContents: targetContents}
|
||||
}
|
||||
*/
|
||||
// All OK.. We can proceed. Type A
|
||||
sourceContent.Name = sourceURL
|
||||
return castURLs{SourceContent: sourceContent, TargetContents: []*client.Content{{Name: targetURL}}}
|
||||
|
||||
@@ -159,6 +159,7 @@ func doPrepareCastURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
console.Errorln(sURLs.Error)
|
||||
break
|
||||
}
|
||||
/* We are going to copy any way now. Let it fail at the time of putObject
|
||||
if !globalForceFlag {
|
||||
if len(sURLs.TargetContents) > 0 {
|
||||
if sURLs.TargetContents[0].Size != 0 || !sURLs.TargetContents[0].Time.IsZero() {
|
||||
@@ -168,6 +169,7 @@ func doPrepareCastURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
jsonData, err := json.Marshal(sURLs)
|
||||
if err != nil {
|
||||
|
||||
@@ -147,6 +147,7 @@ func doPrepareCopyURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
console.Errorln(cpURLs.Error)
|
||||
break
|
||||
}
|
||||
/* Too expensive. Ignore this for now. Let it fail while putObject.
|
||||
if !globalForceFlag {
|
||||
if cpURLs.TargetContent.Size != 0 || !cpURLs.TargetContent.Time.IsZero() {
|
||||
console.Fatalf("Destination already exists, cannot overwrite ‘%s’ with ‘%s’. "+
|
||||
@@ -154,6 +155,7 @@ func doPrepareCopyURLs(session *sessionV2, trapCh <-chan bool) {
|
||||
break
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
jsonData, err := json.Marshal(cpURLs)
|
||||
if err != nil {
|
||||
|
||||
@@ -97,11 +97,13 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) <-chan copyURLs {
|
||||
copyURLsCh <- copyURLs{Error: NewIodine(iodine.New(errInvalidSource{URL: sourceURL}, nil))}
|
||||
return
|
||||
}
|
||||
/* Too expensive. Ignore this for now. Let it fail while putObject.
|
||||
targetClient, err := target2Client(targetURL)
|
||||
if err != nil {
|
||||
copyURLsCh <- copyURLs{Error: NewIodine(iodine.New(err, nil))}
|
||||
return
|
||||
}
|
||||
|
||||
// Target exists?
|
||||
targetContent, err := targetClient.Stat()
|
||||
if err == nil { // Target exists.
|
||||
@@ -112,6 +114,7 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) <-chan copyURLs {
|
||||
copyURLsCh <- copyURLs{SourceContent: sourceContent, TargetContent: targetContent}
|
||||
return
|
||||
}
|
||||
*/
|
||||
// All OK.. We can proceed. Type A
|
||||
sourceContent.Name = sourceURL
|
||||
copyURLsCh <- copyURLs{SourceContent: sourceContent, TargetContent: &client.Content{Name: targetURL}}
|
||||
|
||||
Reference in New Issue
Block a user