Backport #26242 by @silverwind Fixes: https://github.com/go-gitea/gitea/issues/26241 Co-authored-by: silverwind <me@silverwind.io>