fix(api): 修复 Windows Git Bash 下 API 路径被 MSYS2 污染导致 404 #406
Loading…
Reference in New Issue
No description provided.
Delete Branch "chroe/gitlink-cli:fix/msys2-path-pollution"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
在 Windows Git Bash (MSYS2) 环境下执行:
gitlink-cli api GET /v1/owner/repo
路径参数会被 MSYS2 自动改写为类似
C:/Program Files/Git/v1/owner/repo
(MSYS2 把 /v1 当成 Unix 路径,转换为 Git 安装目录),导致 API 调用 404。
影响所有 Windows Git Bash 用户。
修复
在 cmd/api 的 runAPI 中检测路径首部是否为盘符(^[A-Za-z]:/),
若是则按常见 API 前缀(/v1/ /v2/ /api/ /users/ /projects/)定位并还原原始 API 路径。
改动仅 +15 行,不影响其他平台行为。
Pull request closed