优化github上游链接404的处理

This commit is contained in:
starry
2025-08-01 13:19:47 +08:00
committed by GitHub
parent 83a1211067
commit 4ec36da9b5
2 changed files with 8 additions and 1 deletions

View File

@@ -122,6 +122,12 @@ func proxyGitHubWithRedirect(c *gin.Context, u string, redirectCount int) {
}
}()
// 如果Github上游404则返回错误信息
if resp.StatusCode == http.StatusNotFound {
c.String(http.StatusForbidden, "无效的GitHub地址")
return
}
// 检查文件大小限制
cfg := config.GetConfig()
if contentLength := resp.Header.Get("Content-Length"); contentLength != "" {