Download: do not remove a target file that existed beforehand - #107
Open
fingolfin wants to merge 1 commit into
Open
Download: do not remove a target file that existed beforehand#107fingolfin wants to merge 1 commit into
fingolfin wants to merge 1 commit into
Conversation
The clean-up added in #103 removes 'opt.target' after any failed method, which also removes a file that was there before the call. A failed download then destroys a file it never created. Remember whether the file existed when 'Download' was entered, and remove it only if it did not. This also lets the wget method drop its own removal: with the caller's file protected in one place, the per-method clean-up is redundant, and 'RemoveFile' is now called from exactly one place instead of two that disagreed about whether to signal an error when it fails. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #107 +/- ##
==========================================
+ Coverage 86.33% 86.38% +0.04%
==========================================
Files 32 32
Lines 1910 1909 -1
==========================================
Hits 1649 1649
+ Misses 261 260 -1
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The clean-up added in #103 removes
opt.targetafter any failed method, which also removes a file that was there before the call. A failed download then destroys a file it never created.Remember whether the file existed when
Downloadwas entered, and remove it only if it did not.This also lets the wget method drop its own removal: with the caller's file protected in one place, the per-method clean-up is redundant, and
RemoveFileis now called from exactly one place instead of two that disagreed about whether to signal an error when it fails.