mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-14 07:13:30 +00:00
Comments from @gilbertchen, thanks.
This commit is contained in:
@@ -1698,12 +1698,10 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
|
||||
if revisionMap[snapshot.ID][snapshot.Revision] == false {
|
||||
continue
|
||||
}
|
||||
if !manager.config.dryRun {
|
||||
otherManager.storage.CreateDirectory(0, fmt.Sprintf("snapshots/%s", snapshot.ID))
|
||||
description, _ := snapshot.MarshalJSON()
|
||||
path := fmt.Sprintf("snapshots/%s/%d", snapshot.ID, snapshot.Revision)
|
||||
otherManager.SnapshotManager.UploadFile(path, path, description)
|
||||
}
|
||||
LOG_INFO("SNAPSHOT_COPY", "Copied snapshot %s at revision %d", snapshot.ID, snapshot.Revision)
|
||||
}
|
||||
|
||||
|
||||
@@ -2217,12 +2217,10 @@ func (manager *SnapshotManager) DownloadFile(path string, derivationKey string)
|
||||
return nil
|
||||
}
|
||||
|
||||
if !manager.config.dryRun {
|
||||
err = manager.snapshotCache.UploadFile(0, path, manager.fileChunk.GetBytes())
|
||||
if err != nil {
|
||||
LOG_WARN("DOWNLOAD_FILE_CACHE", "Failed to add the file %s to the snapshot cache: %v", path, err)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("DOWNLOAD_FILE", "Downloaded file %s", path)
|
||||
|
||||
@@ -2231,9 +2229,6 @@ func (manager *SnapshotManager) DownloadFile(path string, derivationKey string)
|
||||
|
||||
// UploadFile uploads a non-chunk file from the storage.
|
||||
func (manager *SnapshotManager) UploadFile(path string, derivationKey string, content []byte) bool {
|
||||
if manager.config.dryRun {
|
||||
return true
|
||||
}
|
||||
manager.fileChunk.Reset(false)
|
||||
manager.fileChunk.Write(content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user