Fold case of pull request author's username for preview uploads.

Hostnames are lowercase ASCII, so preview upload authorization would
always fail for repositories whose owners have uppercase letters in
their usernames.

Resolves: https://codeberg.org/git-pages/git-pages/issues/228
This commit is contained in:
miyuko
2026-07-28 01:44:20 +02:00
committed by Catherine
parent 2f810ec65b
commit f31d55c9ef
+1 -1
View File
@@ -620,7 +620,7 @@ func authorizeForgejoActionRun(repoURL string, forgeToken string, prNumber strin
return nil, AuthError{http.StatusUnauthorized, "workflow run not triggered by pull request"}
}
prOwner, prRepository := actionRun.PullRequest.OwnerName, actionRun.PullRequest.RepositoryName
if fmt.Sprintf("/%s/%s.git", prOwner, prRepository) != parsedRepoURL.Path {
if fmt.Sprintf("/%s/%s.git", strings.ToLower(prOwner), prRepository) != parsedRepoURL.Path {
return nil, AuthError{http.StatusUnauthorized, "pull request repository does not match"}
}
if fmt.Sprintf("%d", actionRun.PullRequest.Number) != prNumber {