fix(bundle): resolve file:// download_url via the file-URL helper#3344
Open
jawwad-ali wants to merge 1 commit into
Open
fix(bundle): resolve file:// download_url via the file-URL helper#3344jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
_download_manifest built the local path from raw parsed.path, which keeps the leading slash of file:///C:/x (yielding a \C:\x path that never exists on Windows) and skips percent-decoding (my%20bundles stays encoded on every OS) — so a catalog entry whose download_url is the canonical URI Python itself produces via Path.as_uri() always fails with 'Bundle manifest not found'. Route the file scheme through the existing bundler.services.adapters._file_url_to_path helper, which already handles drive letters, UNC hosts, and percent-decoding for catalog file:// URLs (make_catalog_fetcher). The bare-path branch is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
A catalog entry whose
download_urlis afile://URL — the canonical URI Python itself produces viaPath.as_uri()— always fails to resolve:Raw
parsed.pathhas two problems:file:///C:/Users/x/bundle.yml→parsed.path=/C:/Users/x/bundle.yml→Path(...)=\C:\Users\x\bundle.yml, a leading-slash drive path that never exists.file:///home/user/my%20bundles/bundle.ymlkeeps the literal%20.Reproduced on main @
bba473c:The repo already fixed this exact class of bug for catalog
file://URLs:bundler/services/adapters.py::_file_url_to_pathpercent-decodes viaurl2pathnameand preservesnetlocfor UNC/drive URLs (used bymake_catalog_fetcher)._download_manifestis the one call site that never got the same treatment.Fix
Route the
filescheme through the existing helper (lazy import, matching the file's style); the bare-path/Windows-drive branch keepsPath(url)unchanged.Testing
test_download_manifest_resolves_file_url: manifest undermy bundles/(space in dirname so the percent-encoding failure reproduces on POSIX CI too),download_url=path.as_uri()→ resolvesbundle.id. Fails before (Bundle manifest not found: \C:\...my%20bundles\..., verified by source-stash), passes after.test_download_manifest_bare_windows_path_still_resolves: pins the non-URL branch (passes before and after).tests/integration/test_bundler_local_install.py: 8 passed.uvx ruff checkclean.AI Disclosure
Found and fixed with Claude Code (Claude Fable 5) under my direction. AI identified the raw-
parsed.pathdivergence from the adapters helper; I reproduced the failure on Windows, verified fail-before/pass-after, and reviewed the diff before submitting.