mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
24w19b
This commit is contained in:
parent
a8af0fb687
commit
3489e6d744
4 changed files with 16 additions and 3 deletions
|
|
@ -106,8 +106,15 @@ func NoRouteHandler(cfg *config.Config) gin.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
// 提取用户名和仓库名,格式为 handle/<username>/<repo>/*
|
||||
func MatchUserRepo(rawPath string, cfg *config.Config, c *gin.Context, matches []string) (string, string) {
|
||||
// 提取用户名和仓库名,格式为 handle/<username>/<repo>/*
|
||||
var gistregex = regexp.MustCompile(`^(?:https?://)?gist\.github\.com/([^/]+)/([^/]+)/.*`)
|
||||
var gistmatches []string
|
||||
if gistregex.MatchString(rawPath) {
|
||||
gistmatches = gistregex.FindStringSubmatch(rawPath)
|
||||
logInfo("Gist Matched > Username: %s, URL: %s", gistmatches[2], rawPath)
|
||||
return gistmatches[2], ""
|
||||
}
|
||||
pathmatches := regexp.MustCompile(`^([^/]+)/([^/]+)/([^/]+)/.*`)
|
||||
pathParts := pathmatches.FindStringSubmatch(matches[2])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue