Skip to content

Only cache real pub archives on download - #520

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
pinguinfuss:fix-pub-download-path
Oct 19, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
pinguinfuss:fix-pub-download-path

Conversation

@pinguinfuss

Copy link
Copy Markdown
Contributor

Pub downloads without .tar.gz fetched the HTML version page from pub.dev and cached it as the archive. One request to /pub/packages/http/versions/1.2.0 was enough to break http-1.2.0.tar.gz for everyone after.

Such requests now get a 404. Invalid package names are rejected, and the upstream URL is built from the escaped name and version, so an encoded ? or # can't turn into a query or fragment.

Archives that were already cached this way are discarded and fetched again on the next download.

…dev and cached it as the archive, so one request broke that version for everyone after; they now get a 404, and the upstream URL is built from the escaped name and version so an encoded ? or # can't become a query or fragment.
…re now discarded and fetched again, so versions that were already broken heal on the next download.

@simonchrz simonchrz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Verified that mirrored pub artifacts aren't caught by the cleanup: registries builds pub download URLs with the .tar.gz suffix, so their UpstreamURL passes the check. Tests pass locally.

Non-blocking: discardVersionPage adds a GetArtifact lookup to every pub download, cache hits included, only to repair entries from older versions. That's cheap, but it could be dropped again after a release or two. Worth a comment saying so.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The archive suffix check prevents version pages from entering the archive cache, and the repair path preserves valid cached archives. No actionable findings.

@andrew
andrew merged commit cf463c1 into git-pkgs:main Oct 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants