Skip to content

fix(install): add api.github.com fallback for version detection in install.sh#110

Merged
largeoliu merged 1 commit into
masterfrom
fix/install-version-fallback
May 10, 2026
Merged

fix(install): add api.github.com fallback for version detection in install.sh#110
largeoliu merged 1 commit into
masterfrom
fix/install-version-fallback

Conversation

@largeoliu
Copy link
Copy Markdown
Owner

Summary

install.shget_latest_version() 函数仅依赖 github.com/releases/latest 的 HTTP 重定向来获取版本号。当该域名不可达时(常见于国内网络环境),安装脚本会直接报错退出,而 install.ps1 已有 api.github.com 的 fallback 机制。

Changes

  • get_latest_version() 添加 fallback:当 github.com/releases/latest 不可达时,自动通过 api.github.com/repos/${REPO}/releases/latest API 获取 tag_name
  • API 请求带上 User-Agent header 以避免被限流

Test

github.com 连接超时的网络环境下验证:

  • 主路径(重定向)不可达 → 自动 fallback 到 API
  • API 成功返回 v0.5.0

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@largeoliu largeoliu merged commit 8e730b4 into master May 10, 2026
17 checks passed
@largeoliu largeoliu deleted the fix/install-version-fallback branch May 10, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants