download manager improvements#45
Merged
Merged
Conversation
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.
Description
This PR significantly improves how incomplete downloads are handled and finalized in the
DownloadManager. It introduces a dedicated incomplete download directory, ensures files are safely resumed and finalized, and prevents accidental overwrites of completed downloads. The changes also enhance security and correctness in file handling.Incomplete Download Handling and File Finalization:
incompleteDownloadDirectoryproperty to theDownloadSettingsProvidingprotocol and implemented logic inDownloadManagerto use a dedicated directory for incomplete downloads, improving separation and management of partial files. [1] [2]computeIncompletePathand related helpers to generate unique, safe paths for incomplete files, including SHA256-based disambiguation and safe filename truncation.finalizeCompletedDownloadto move files from the incomplete directory to their final destination, ensuring that existing files are never overwritten by appending a suffix if necessary.Correctness and Robustness Improvements:
Protocol and Import Updates:
File Transfer Token Handling:
These changes together make the download process safer, more reliable, and more user-friendly, especially in cases of interrupted or repeated downloads.
How to test
Author checklist
This PR: