mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
fix
This commit is contained in:
parent
20b9c7827d
commit
ee215eff36
2 changed files with 3 additions and 4 deletions
1
init.sh
1
init.sh
|
|
@ -10,7 +10,6 @@ if [ ! -f /data/${APPLICATON}/config/blacklist.yaml ]; then
|
||||||
cp /data/${APPLICATON}/blacklist.yaml /data/${APPLICATON}/config/blacklist.yaml
|
cp /data/${APPLICATON}/blacklist.yaml /data/${APPLICATON}/config/blacklist.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /data/${APPLICATON}/config/config.yaml ]; then
|
if [ ! -f /data/${APPLICATON}/config/config.yaml ]; then
|
||||||
cp /data/${APPLICATON}/config.yaml /data/${APPLICATON}/config/config.yaml
|
cp /data/${APPLICATON}/config.yaml /data/${APPLICATON}/config/config.yaml
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@ func NoRouteHandler(cfg *config.Config, blacklist *config.Blacklist) gin.Handler
|
||||||
|
|
||||||
// 提取用户名和仓库名,格式为 <username>/<repo>
|
// 提取用户名和仓库名,格式为 <username>/<repo>
|
||||||
pathParts := strings.Split(matches[2], "/")
|
pathParts := strings.Split(matches[2], "/")
|
||||||
if len(pathParts) < 2 {
|
if len(pathParts) < 3 {
|
||||||
logw("Invalid path: %s", rawPath)
|
logw("Invalid path: %s", rawPath)
|
||||||
c.String(http.StatusForbidden, "Invalid path; expected username/repo.")
|
c.String(http.StatusForbidden, "Invalid path; expected username/repo.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
username := pathParts[0]
|
username := pathParts[1]
|
||||||
repo := pathParts[1]
|
repo := pathParts[2]
|
||||||
logw("Blacklist Check > Username: %s, Repo: %s", username, repo)
|
logw("Blacklist Check > Username: %s, Repo: %s", username, repo)
|
||||||
|
|
||||||
// 检查仓库是否在黑名单中
|
// 检查仓库是否在黑名单中
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue