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

Open
#14,821 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
cli

Research direction

Start in src/extension/extension-host.ts at githubLatestUrlProvider.extensionUrl() and trace how extensionSource() and makeResolvers() select providers. Reproduce with quarto add nickriches/quarto-paper-pile, then make the no-ref lookup handle repositories whose default branch is not main, while preserving explicit @branch behavior. Done means the reported master-default repository installs without @master instead of returning “Extension not found in local or remote sources”.

Written by the indexing model from the issue text.

Description

bug extensions

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).

Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/quarto-cli

All issues in quarto-dev/quarto-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.