`q2 add owner/repo@<sha>` fails for a commit SHA

Abierto Apto para principiantes
#1,005 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@cscheid ya está trabajando en esto.

Desde el 2/11/2026.

  • #1006 de @cscheid — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, rust
Área
tooling

Línea de trabajo

La búsqueda de referencias está en parse_github en crates/quarto-source-fetch/src/target.rs, alrededor de las líneas 161-173, donde se prueban los candidatos de archivo para tag y head. Lee esa lista de candidatos y el bucle de descarga que pasa de largo las respuestas no 2xx. Está terminado cuando q2 add owner/repo@<sha> (SHA completo y abreviado) instala la extensión, y un tag o una rama con el mismo nombre sigue teniendo prioridad.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug description

q2 add accepts <gh-org>/<gh-repo>[/<subdir>][@<ref>], the URL of a .zip or .tar.gz archive, or a local archive or folder.
The @<ref> can be a tag or a branch, but not a commit.

For @<ref>, parse_github tries archive/refs/tags/<ref> and then archive/refs/heads/<ref>, and GitHub answers 404 to both when the ref is a commit SHA:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-source-fetch/src/target.rs#L161-L173

GitHub serves a commit at archive/<sha>.tar.gz, with the full or the short SHA, so the archive exists.
Pinning a commit helps with an extension that has no releases, or when you want to try a fix before it's released.
Quarto 1 has the same gap.

Steps to reproduce
mkdir q2-sha && cd q2-sha
q2 add quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7 --trust --no-prompt
q2 add quarto-ext/fontawesome@6b52091 --trust --no-prompt

For comparison, a tag and the full archive URL both install:

q2 add quarto-ext/[email protected] --trust --no-prompt
q2 add https://github.com/quarto-ext/fontawesome/archive/6b52091.tar.gz --trust --no-prompt
Actual behavior
Error: Could not get an extension from quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7
could not download quarto-ext/fontawesome@6b520912a7b26a72e1b0826f6b201c2e69b2b3c7 on GitHub: tried 2 location(s): https://github.com/quarto-ext/fontawesome/archive/refs/tags/6b520912a7b26a72e1b0826f6b201c2e69b2b3c7.tar.gz → HTTP 404; https://github.com/quarto-ext/fontawesome/archive/refs/heads/6b520912a7b26a72e1b0826f6b201c2e69b2b3c7.tar.gz → HTTP 404

The short SHA fails the same way.
The URL form works, but .quarto-source.yml then records kind: url and the URL, not the repository and the commit.

Expected behavior

The extension installs at that commit.
One way would be to add archive/<ref>.tar.gz as a third candidate after tags and heads.
The fetch loop already moves on after a non-2xx status, so a tag or a branch with the same name still wins.

Your environment
  • q2: Q2 (quarto 2) 0.40.0-nightly.20261101 (nightly built from a2a1cb9).
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
Lenguaje dominante
Rust
Estrellas
283
Forks
20
Merge medio
19 h 33 min
PR fusionados (30 d)
165

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/q2

Todos los issues de quarto-dev/q2

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.