bundle catalog add rewrites Windows drive paths as POSIX paths
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia da src/specify_cli/bundles/catalog_config.py in _is_local_path e _canonicalize_url, e segui come add_source() (intorno alla riga 184) salva il risultato. I percorsi con unità Windows non dovrebbero passare per il Path(...).resolve() nativo dell'host su POSIX; si mantiene il valore invariato oppure lo si rifiuta. È completato quando bundle catalog add C:\catalog.json non scrive più un URL relativo alla directory corrente, e viene aggiunto un test per questo caso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 144k
- Fork
- 12.9k
- Merge medio
- 1g 4h
- PR unite (30g)
- 181
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/spec-kit
-
The Python branch-creation port accepts an oversized `--number` and crashes at `int()` instead of rejecting itForse già presa @github-actions l’ha presa 3 giorni fa. Apertabug-assess bug-fix fix-proposed severity-low triage-can-wait
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github/spec-kit#5194 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Cline extension and preset commands have `speckit.*.md` file names rewritten to `speckit-*-md`Forse già presa @kevin9327 l’ha presa 5 giorni fa. Apertatriage-can-wait
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `create-new-feature.sh` rejects the feature descriptions `-n`, `-e` and `-E`, which the Python script acceptsForse già presa @WOLIKIMCHENG l’ha presa 7 giorni fa. Apertatriage-can-wait
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `bundle init <bundle>` initialises with the default integration instead of the bundle's, then aborts with a clashForse già presa @chelsealong l’ha presa 9 giorni fa. Apertatriage-must-have
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `specify preset set-priority` does not update agent command files that are already writtenForse già presa @mikamikasuki l’ha presa 9 giorni fa. Apertatriage-must-have
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di github/spec-kit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
elviskahoro/sdk-python-attio#144 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
RenyiELBO raises TypeError when model has no sample sitesForse già presa @alibb007 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno