Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix download error of an updated file leads to online file deletion #3017

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -2830,7 +2830,7 @@ class SyncEngine {
// Was this item previously in-sync with the local system?
// We previously searched for the file in the DB, we need to use that record
if (fileFoundInDB) {
// Purge DB record so that the deleted local file does not cause an online delete
// Purge DB record so that the deleted local file does not cause an online deletion
// In a --dry-run scenario, this is being done against a DB copy
addLogEntry("Removing DB record due to failed integrity checks");
itemDB.deleteById(databaseItem.driveId, databaseItem.id);
Expand All @@ -2847,6 +2847,16 @@ class SyncEngine {
} // end of (!disableDownloadValidation)
} else {
addLogEntry("ERROR: File failed to download. Increase logging verbosity to determine why.");
// Was this item previously in-sync with the local system?
// We previously searched for the file in the DB, we need to use that record
if (fileFoundInDB) {
// Purge DB record so that the deleted local file does not cause an online deletion
// In a --dry-run scenario, this is being done against a DB copy
addLogEntry("Removing existing DB record due to failed file download.");
itemDB.deleteById(databaseItem.driveId, databaseItem.id);
}

// Flag that the download failed
downloadFailed = true;
}
}
Expand Down
Loading