mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 11:11:35 +00:00
Allow explicit authorization to bypass wildcard URL restriction.
This commit is contained in:
13
src/pages.go
13
src/pages.go
@@ -217,12 +217,15 @@ func postPage(w http.ResponseWriter, r *http.Request) error {
|
||||
|
||||
allowRepoURL := ""
|
||||
if slices.Equal(hostParts[1:], strings.Split(config.Wildcard.Domain, ".")) {
|
||||
userName := hostParts[0]
|
||||
repoName := projectName
|
||||
if repoName == ".index" {
|
||||
repoName = fmt.Sprintf(config.Wildcard.IndexRepo, userName)
|
||||
// explicit authorization bypasses wildcard domain restrictions
|
||||
if err := Authorize(w, r); err != nil {
|
||||
userName := hostParts[0]
|
||||
repoName := projectName
|
||||
if repoName == ".index" {
|
||||
repoName = fmt.Sprintf(config.Wildcard.IndexRepo, userName)
|
||||
}
|
||||
allowRepoURL = fmt.Sprintf(config.Wildcard.CloneURL, userName, repoName)
|
||||
}
|
||||
allowRepoURL = fmt.Sprintf(config.Wildcard.CloneURL, userName, repoName)
|
||||
} else {
|
||||
if err := Authorize(w, r); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user