mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-13 14:53:28 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -1307,7 +1307,7 @@ func benchmark(context *cli.Context) {
|
|||||||
if storage == nil {
|
if storage == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
duplicacy.Benchmark(repository, storage, int64(fileSize)*1000000, chunkSize*1024*1024, chunkCount, uploadThreads, downloadThreads)
|
duplicacy.Benchmark(repository, storage, int64(fileSize) * 1024 * 1024, chunkSize * 1024 * 1024, chunkCount, uploadThreads, downloadThreads)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
Binary file not shown.
@@ -190,7 +190,16 @@ func (storage *FileStorage) UploadFile(threadIndex int, filePath string, content
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file.Close()
|
err = file.Sync()
|
||||||
|
if err != nil {
|
||||||
|
file.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = file.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = os.Rename(temporaryFile, fullPath)
|
err = os.Rename(temporaryFile, fullPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -624,13 +624,22 @@ func (storage *GCDStorage) DownloadFile(threadIndex int, filePath string, chunk
|
|||||||
var response *http.Response
|
var response *http.Response
|
||||||
|
|
||||||
for {
|
for {
|
||||||
response, err = storage.service.Files.Get(fileID).Download()
|
// AcknowledgeAbuse(true) lets the download proceed even if GCD thinks that it contains malware.
|
||||||
if retry, err := storage.shouldRetry(threadIndex, err); err == nil && !retry {
|
// TODO: Should this prompt the user or log a warning?
|
||||||
|
req := storage.service.Files.Get(fileID)
|
||||||
|
if e, ok := err.(*googleapi.Error); ok {
|
||||||
|
if strings.Contains(err.Error(), "cannotDownloadAbusiveFile") || len(e.Errors) > 0 && e.Errors[0].Reason == "cannotDownloadAbusiveFile" {
|
||||||
|
LOG_WARN("GCD_STORAGE", "%s is marked as abusive, will download anyway.", filePath)
|
||||||
|
req = req.AcknowledgeAbuse(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response, err = req.Download()
|
||||||
|
if retry, retry_err := storage.shouldRetry(threadIndex, err); retry_err == nil && !retry {
|
||||||
break
|
break
|
||||||
} else if retry {
|
} else if retry {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
return err
|
return retry_err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user