diff --git a/init.sh b/init.sh index fc11495..75f1c6c 100644 --- a/init.sh +++ b/init.sh @@ -10,7 +10,6 @@ if [ ! -f /data/${APPLICATON}/config/blacklist.yaml ]; then cp /data/${APPLICATON}/blacklist.yaml /data/${APPLICATON}/config/blacklist.yaml fi - if [ ! -f /data/${APPLICATON}/config/config.yaml ]; then cp /data/${APPLICATON}/config.yaml /data/${APPLICATON}/config/config.yaml fi diff --git a/proxy/proxy.go b/proxy/proxy.go index 882c51e..bc83cc7 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -39,13 +39,13 @@ func NoRouteHandler(cfg *config.Config, blacklist *config.Blacklist) gin.Handler // 提取用户名和仓库名,格式为 / pathParts := strings.Split(matches[2], "/") - if len(pathParts) < 2 { + if len(pathParts) < 3 { logw("Invalid path: %s", rawPath) c.String(http.StatusForbidden, "Invalid path; expected username/repo.") return } - username := pathParts[0] - repo := pathParts[1] + username := pathParts[1] + repo := pathParts[2] logw("Blacklist Check > Username: %s, Repo: %s", username, repo) // 检查仓库是否在黑名单中