fix(extensions): apply GHES auth and resolve release assets for extension add --from#18
Closed
mnriem wants to merge 1 commit into
Closed
fix(extensions): apply GHES auth and resolve release assets for extension add --from#18mnriem wants to merge 1 commit into
extension add --from#18mnriem wants to merge 1 commit into
Conversation
The 'specify extension add --from <url>' path fetched ZIPs via a bare open_url with no GitHub release-asset resolution and no Accept header, diverging from the catalog download path. Against GHES it received an HTML login page and failed obscurely with zipfile.BadZipFile. Route --from through ExtensionCatalog so configured GHES credentials apply and release-download URLs resolve via /api/v3, and reject non-ZIP content with a clear error pointing at auth.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Problem
specify extension add <name> --from <GHES-url>does not apply configured GHES authentication when downloading the ZIP. It received an HTML login page instead of the binary and failed withzipfile.BadZipFileatinstall_from_zip. Both the catalog and asset URLs are valid and return correct content when auth is applied (verified viacurlwith a Bearer token).Root cause
The
--frompath fetched the ZIP through a bareopen_url(from_url)call — unlike the catalog download path (ExtensionCatalog.download_extension), it skipped:/releases/download/...→/api/v3/.../releases/assets/...)Accept: application/octet-streamheaderWhen auth didn't match (or returned 401/403),
open_urlsilently fell through to an unauthenticated request and got a 200 HTML login page, which was written to disk and blew up asBadZipFile.Fix
Route
--fromthroughExtensionCatalogso it mirrors catalog installs:/api/v3asset API and addAccept: application/octet-stream.auth.jsoncredentials apply.PKmagic) with a clear error pointing atauth.json, instead of an opaqueBadZipFile.This matches the equivalent fix already present for
preset add --from.Tests
BadZipFile)./api/v3with octet-stream Accept.--fromfixtures to valid ZIP magic bytes.Full
tests/test_extensions.pysuite: 324 passed.Assisted-by: GitHub Copilot (model: Claude Opus 4.8, supervised)