Skip to content

quarto add owner/repo fails on repos whose default branch isn't main #14821

Description

@cderv

quarto add owner/repo (no @ref modifier) only ever tries https://github.com/OWNER/REPO/archive/refs/heads/main.tar.gz. If the repo's default branch is master (or anything else), that request 404s and the resolver gives up with:

Extension not found in local or remote sources

There's no fallback to master and no call to GitHub's API to look up the repo's actual default_branch.

Source: src/extension/extension-host.ts, githubLatestUrlProvider.extensionUrl() (~line 114), invoked via extensionSource()/makeResolvers(). githubBranchUrlProvider can hit an arbitrary branch, but only when the user explicitly writes @branch — it's never tried automatically as a fallback.

Repro:

$ quarto add nickriches/quarto-paper-pile
Extension not found in local or remote sources

$ quarto add nickriches/quarto-paper-pile@master
# installs fine

(nickriches/quarto-paper-pile's default branch is master.) Quarto version: 1.11.1.

Expected: either query the repo's default_branch via the GitHub API before guessing, or fall back to master when main 404s.

Found while reviewing quarto-dev/quarto-web#2149 (a master-default extension submitted to the extension listing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingextensionsrelates to Quarto extensions mechanism

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions