Fixes https://github.com/go-gitea/gitea/issues/30365, regression from https://github.com/go-gitea/gitea/pull/30281