From ee215eff368d2df0d7bc269f6f790976371d6775 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Sat, 5 Oct 2024 23:15:46 +0800 Subject: [PATCH] fix --- init.sh | 1 - proxy/proxy.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) 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) // 检查仓库是否在黑名单中