in Upstream() call CheckIfOwnerExists to block requests for new users/orgs

This commit is contained in:
Andreas Shimokawa
2026-06-24 17:05:17 +02:00
parent 21a4cab10b
commit 97139b5414
+6
View File
@@ -134,6 +134,12 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client, redi
return true
}
exists, _ := giteaClient.GiteaCheckIfOwnerExists(o.TargetOwner)
if !exists {
html.ReturnErrorPage(ctx, "forge client: new users/orgs are not allowed to use the old pages server. See https://codeberg.page on using git-pages", http.StatusBadRequest)
return true
}
// Check if the branch exists and when it was modified
if o.BranchTimestamp.IsZero() {
branchExist, err := o.GetBranchTimestamp(giteaClient)