Backport of #37662. --- This PR was written with the help of Claude Opus 4.7 --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>