Skip re-downloads for existing converted files in UniversalDownloaderPlatform - #23
Open
ProtagNeptune wants to merge 1 commit into
Open
Skip re-downloads for existing converted files in UniversalDownloaderPlatform#23ProtagNeptune wants to merge 1 commit into
ProtagNeptune wants to merge 1 commit into
Conversation
…niversalDownloaderPlatform) (#1) * Initial plan * feat: resolve equivalent existing output files Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * feat: use resolved existing files in downloader pre-checks Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: skip downloads when converted equivalent file already exists Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * fix: address FileExistsActionHelper review feedback Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * fix: case-insensitive basename match and unknown remote size handling Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * WIP: plan fix for wildcard-safe basename enumeration Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> * fix: avoid wildcard interpretation in ResolveExistingFilePath basename scan Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ProtagNeptune <93203147+ProtagNeptune@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent unnecessary re-downloads when an already-downloaded “converted” variant of the target file exists on disk, reducing redundant network usage and local storage churn across multiple downloader engines.
Changes:
- Added
FileExistsActionHelper.ResolveExistingFilePath(...)and updated pre-download existence handling to recognize same-basename files with different extensions. - Updated Mega, Web, and Google Drive downloaders to use the new “existing path vs requested path” flow and to create the target directory more safely.
- Introduced a new
UniversalDownloaderPlatform.Common.Testsproject with xUnit tests covering the new helper behaviors.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| UniversalDownloaderPlatform.sln | Adds the new Common test project to the solution and build configs. |
| UniversalDownloaderPlatform.MegaDownloader/MegaDownloader.cs | Uses ResolveExistingFilePath + updated pre-download existence API; fixes directory creation logic. |
| UniversalDownloaderPlatform.GoogleDriveDownloader/GoogleDriveEngine.cs | Moves/updates existence checks to happen after Google-doc export path selection; fixes directory creation logic. |
| UniversalDownloaderPlatform.DefaultImplementations/WebDownloader.cs | Uses ResolveExistingFilePath + updated pre-download existence API; fixes directory creation logic. |
| UniversalDownloaderPlatform.Common/Helpers/FileExistsActionHelper.cs | Implements “converted equivalent” detection and updates file-exists decision logic. |
| UniversalDownloaderPlatform.Common.Tests/UniversalDownloaderPlatform.Common.Tests.csproj | New xUnit test project for Common helpers. |
| UniversalDownloaderPlatform.Common.Tests/FileExistsActionHelperTests.cs | Adds unit tests for the new helper behaviors (exact match, converted-equivalent match, and size-check logic). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Made this because it kept redownloading files that already existed as converted files to take less space on my drives.