fix(self-update): 修复 gh-proxy 前缀代理触发 uv panic - #11
Merged
MimoKit merged 2 commits intoJul 27, 2026
Conversation
gh-proxy 风格前缀代理产生含多个 :// 的套娃 URL,uv 解析 git+套娃URL@ref 时其 URL 解析器 panic (AmbiguousAuthority)。检测套娃 URL (count(://) > 1) 时走 pip;干净 URL (直连/CNB镜像) 保留 uv。 新增 test_build_self_update_command_uses_pip_for_prefix_proxy。
store.py: build_self_update_command 的 if 条件压单行(本 PR 代码)。api.py: 顺带 format master 既有 _re.match/raw_url(上游 format 债,非本 PR 引入,让 prek --all-files 过)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
启用 gh-proxy 风格前缀代理(
MIMO_CONSOLE_GITHUB_PROXY=https://gh-proxy.com,即GITHUB_PROXY_PRESETS内置预设之一)后,概览页「一键更新」必然失败:根因
resolve_git_url()把前缀代理拼到 GitHub URL 前,产生含多个://的套娃 URL:https://gh-proxy.com/https://github.com/MimoKit/nonebot-plugin-mimo-console.gitbuild_self_update_command()的 uv 分支拼成pkg @ git+<套娃URL>,uv 解析git+<套娃URL>@<ref>时其 URL 解析器(url crate)对「多://+@ref」报AmbiguousAuthority并 panic。git clone 本身能成功(日志里 Updating/Updated 已拉到 commit),崩在随后 uv 内部解析阶段。pip 分支(
pip install --upgrade git+<套娃URL>)把套娃 URL 当普通 HTTPS 直接 git clone,正常工作。修复
build_self_update_command()增加套娃判定,套娃 URL 走 pip,干净 URL 保留 uv:测试
新增
test_build_self_update_command_uses_pip_for_prefix_proxy:在有 uv + pyproject 的前提下,套娃 URL 仍走 pip。全部 store 测试通过。附:uv 的 panic
畸形/套娃 git URL 应报清晰错误而非 thread panic。reproducer:
uv add "x @ git+https://gh-proxy.com/https://github.com/MimoKit/nonebot-plugin-mimo-console.git"。建议一并反馈 astral-sh/uv。