From bec3a0edcd6329ed57d287eec996858a3621f567 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Tue, 3 Nov 2020 10:57:47 -0500 Subject: [PATCH] Fixed a bug that caused a fresh restore to fail without the -overwrite option When restoring a file that doesn't exit locally, if the file is large (>100M) Duplicacy will create an empty sparse file. But this newly created file will be mistaken for a local copy and hence the restore will fail with a message suggesting the -overwrite option. --- src/duplicacy_backupmanager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/duplicacy_backupmanager.go b/src/duplicacy_backupmanager.go index df1a3211..d4f4c4df 100644 --- a/src/duplicacy_backupmanager.go +++ b/src/duplicacy_backupmanager.go @@ -1377,7 +1377,7 @@ func (manager *BackupManager) RestoreFile(chunkDownloader *ChunkDownloader, chun } // fileHash != entry.Hash, warn/error depending on -overwrite option - if !overwrite { + if !overwrite && !isNewFile { LOG_WERROR(allowFailures, "DOWNLOAD_OVERWRITE", "File %s already exists. Please specify the -overwrite option to overwrite", entry.Path) return false, fmt.Errorf("file exists")