bundle catalog add rewrites Windows drive paths as POSIX paths
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
Comece em src/specify_cli/bundles/catalog_config.py em _is_local_path e _canonicalize_url, e acompanhe como add_source() (por volta da linha 184) armazena o resultado. Caminhos de unidade do Windows não devem passar pelo Path(...).resolve() nativo do host em POSIX; mantenha o valor como está ou rejeite-o. Está concluído quando bundle catalog add C:\catalog.json não grava mais uma URL relativa ao diretório atual, e um teste for adicionado para esse caso.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
_is_local_path() explicitly recognizes a Windows drive path such as
C:\catalog.json, but _canonicalize_url() then passes it to the host-native
Path(...).resolve(). On Linux and macOS that turns the Windows absolute path
into a path relative to the current project, and add_source() persists the
rewritten value into the catalog configuration.
Environment
- Repository:
github/spec-kit - Target revision:
1c799bda6c136fcf42fb3475a922ccaac57e6c71 - Platform: macOS (POSIX), Python 3.13
- File:
src/specify_cli/bundles/catalog_config.py:96-116
(_is_local_path,_canonicalize_url), used byadd_source()at:184
Expected behavior
A Windows absolute path is either preserved verbatim in the configuration or
rejected as non-local on a POSIX host. It must not be silently rewritten into a
different path.
Actual behavior
Adding C:\catalog.json on macOS persists:
catalogs:
- id: c---catalog
url: /private/tmp/.../project/C:\catalog.json
priority: 50
install_policy: install-allowed
The stored URL points at a non-existent file whose name contains a backslash
and a colon; later catalog reads fail to resolve the intended source.
Root cause
_WINDOWS_DRIVE_RE = re.compile(r"^[A-Za-z]:[\\/]")
def _is_local_path(url: str) -> bool:
if _WINDOWS_DRIVE_RE.match(url):
return True
...
def _canonicalize_url(url: str) -> str:
if _is_local_path(url):
return str(Path(url).expanduser().resolve())
return url
The Windows-drive branch is platform-independent, while Path is host-native.
On POSIX, Path(r"C:\catalog.json").resolve() produces
<cwd>/C:\catalog.json; on Windows it would be absolute. The same function is
reached from the public bundle catalog add path through add_source().
Impact
- A catalog configuration produced on Windows and consumed on Linux/macOS (or a
Windows path passed on a POSIX host) is silently corrupted instead of being
rejected. - The stored catalog id (
c---catalog) and URL both diverge from the user's
input, and the source cannot be loaded.
Suggested fix
Preserve Windows drive paths on non-Windows hosts instead of resolving them
with the host-native Path:
def _canonicalize_url(url: str) -> str:
if _WINDOWS_DRIVE_RE.match(url):
return url # do not reinterpret on POSIX
if _is_local_path(url):
return str(Path(url).expanduser().resolve())
return url
or canonicalize with PureWindowsPath when the host is POSIX and the input
matches the Windows-drive form, and reject the value if it cannot be resolved.
- Linguagem predominante
- Python
- Estrelas
- 144k
- Forks
- 12.9k
- Merge médio
- 1d 4h
- PRs com merge (30d)
- 181
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/spec-kit
-
The Python branch-creation port accepts an oversized `--number` and crashes at `int()` instead of rejecting itTalvez já em andamento @github-actions assumiu há 3 dias. Abertabug-assess bug-fix fix-proposed severity-low triage-can-wait
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
github/spec-kit#5194 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: Cline extension and preset commands have `speckit.*.md` file names rewritten to `speckit-*-md`Talvez já em andamento @kevin9327 assumiu há 5 dias. Abertatriage-can-wait
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
[Bug]: `create-new-feature.sh` rejects the feature descriptions `-n`, `-e` and `-E`, which the Python script acceptsTalvez já em andamento @WOLIKIMCHENG assumiu há 7 dias. Abertatriage-can-wait
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
[Bug]: `bundle init <bundle>` initialises with the default integration instead of the bundle's, then aborts with a clashTalvez já em andamento @chelsealong assumiu há 9 dias. Abertatriage-must-have
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
[Bug]: `specify preset set-priority` does not update agent command files that are already writtenTalvez já em andamento @mikamikasuki assumiu há 9 dias. Abertatriage-must-have
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
Mantenedores costumam responder em até 1 dia
Todas as issues de github/spec-kit
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
elviskahoro/sdk-python-attio#144 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
RenyiELBO raises TypeError when model has no sample sitesTalvez já em andamento @alibb007 assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia