Repository navigation
Use shared archives browser for cached artifacts - #512
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
simonchrz
left a comment
There was a problem hiding this comment.
One behaviour change: archives.Browser.Extract now returns ErrIsDir for implicit directories too, and browseFile maps that to a 500 with an error log. With a tarball holding only pkg/src/a.go, GET …/file/src returns 404 on main and 500 on this branch. Since a client can trigger it with any directory path, mapping ErrIsDir to 404 (or redirecting to the listing) without the error log seems right.
Otherwise this looks good: same format detection, limits and reopen behaviour as the removed code, and the single-file root fix is covered. Small optional extra: OpenBrowserContext(r.Context(), …) would stop decompression when the client goes away.
Happy to approve once the ErrIsDir mapping is in.
e5fd216 to
ac8ebb8
Compare
Use
archives.OpenBrowserfor cached archive listings and file reads, removing the local streaming browser and format table. Keep proxy's limits, HTTP error mapping, storage reopen callback, and npmpackage/prefix. Use shared common-root detection for version diffs too, so archives containing onlyREADME.mdremain visible.Uses archives
v0.9.0, which includes git-pkgs/archives#56.