From d0cd13fce751290e18d5cb178fc3d6856ab69e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= <44814898+BruebachL@users.noreply.github.com> Date: Sun, 8 Nov 2026 19:33:44 +0100 Subject: [PATCH] [DeckSync] Drop the queued download when a local delete wins The unmatched-server-rows pass queued a download for every row with no local file, including rows whose sidecar record is being deleted in the same run. The delete ran first, so the download then failed with NameNotFound and the summary reported a clean delete as removed plus skipped. Cancel the pending download for the deleted row id instead; a failed delete keeps it, which preserves the restore-the-file fallback. --- cockatrice/src/interface/deck_sync/deck_sync_manager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cockatrice/src/interface/deck_sync/deck_sync_manager.cpp b/cockatrice/src/interface/deck_sync/deck_sync_manager.cpp index 92fa1e132..560f238d6 100644 --- a/cockatrice/src/interface/deck_sync/deck_sync_manager.cpp +++ b/cockatrice/src/interface/deck_sync/deck_sync_manager.cpp @@ -762,8 +762,16 @@ void DeckSyncManager::onDeleteFinished(const Response &response, if (response.response_code() == Response::RespOk || response.response_code() == Response::RespNameNotFound) { DeckSyncSidecar sidecar(sidecarPath); sidecar.load(); + const int deletedDeckId = sidecar.get(relativePath).remoteId; sidecar.remove(relativePath); sidecar.save(); + if (deletedDeckId != -1) { + // The unmatched-server-rows pass queued a download for this row before + // the delete ran. The delete won, so drop the download instead of + // letting it fail with NameNotFound and count as a skipped deck. A + // failed delete leaves the download in place as the fallback. + pendingDownloads.removeIf([deletedDeckId](const DownloadOp &op) { return op.deckId == deletedDeckId; }); + } ++removedCount; } else { ++skippedCount;