bundle catalog add rewrites Windows drive paths as POSIX paths
維護者通常 1 天內回覆
評估
研究方向
從 src/specify_cli/bundles/catalog_config.py 中的 _is_local_path 和 _canonicalize_url 開始,追蹤 add_source()(約第 184 行)如何儲存結果。Windows 磁碟機路徑在 POSIX 上不應經過主機原生的 Path(...).resolve();要麼原樣保留該值,要麼拒絕它。完成標準是 bundle catalog add C:\catalog.json 不再寫入相對於目前工作目錄的 URL,並為此情況新增測試。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Python
- 星號
- 144k
- 分支
- 12.9k
- 平均合併
- 1 天 4 小時
- 30 天內合併 PR
- 181
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/spec-kit 的其他 Issue
-
The Python branch-creation port accepts an oversized `--number` and crashes at `int()` instead of rejecting it可能已有人在做 @github-actions 於 3 天前認領。 未關閉bug-assess bug-fix fix-proposed severity-low triage-can-wait
難度 2/5 1-3 小時 新手友好度 84/100
github/spec-kit#5194 · 3 則留言 ·
維護者通常 1 天內回覆
-
[Bug]: Cline extension and preset commands have `speckit.*.md` file names rewritten to `speckit-*-md`可能已有人在做 @kevin9327 於 5 天前認領。 未關閉triage-can-wait
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
[Bug]: `create-new-feature.sh` rejects the feature descriptions `-n`, `-e` and `-E`, which the Python script accepts可能已有人在做 @WOLIKIMCHENG 於 7 天前認領。 未關閉triage-can-wait
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
[Bug]: `bundle init <bundle>` initialises with the default integration instead of the bundle's, then aborts with a clash可能已有人在做 @chelsealong 於 9 天前認領。 未關閉triage-must-have
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
[Bug]: `specify preset set-priority` does not update agent command files that are already written可能已有人在做 @mikamikasuki 於 8 天前認領。 未關閉triage-must-have
難度 2/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
aws/sagemaker-python-sdk#6554 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 78/100
huggingface/diffusers#15170 ·
維護者通常 1 天內回覆
-
[BUG] LLM conflict check ignores MNEMOSYNE_LLM_MAX_TOKENS, so reasoning models return empty replies未關閉
難度 2/5 1-3 小時 新手友好度 62/100
mnemosyne-oss/mnemosyne#1325 ·
維護者通常 1 天內回覆
-
enhancement meshtastic-2.8
難度 2/5 1-3 小時 新手友好度 62/100
pskillen/meshflow-api#459 ·