Skip to content

Redirect between Issue/PR Number not working if one of both is disabled in Repo Settings #35419

@DrMaxNix

Description

@DrMaxNix

Description

Normally, if #17 is a Pull Request and you enter .../issues/17 as the url, you will be redirected to .../pulls/17. This, however, does not happen if the issues tab is disabled in the repo settings and produces a "404 Not Found" when visiting .../issues/17. The effect of this is not only that mistyped urls won't be fixed for you, but (and this is much more of a problem) gitea relies on this mechanism internally. When referencing an issue/PR number in a commit message (eg. foo bar baz (fix #17)), gitea will add an anchor to this number on the website, which will always be of the form /{user}/{repo}/issues/{number}, even if the number referenced by the commit message is in fact a PR.

Steps to reproduce:

  1. Visit this repo: https://git.tjdev.de/tjdev/dns-watch-2022
  2. See the commit message 🩹 get reference list working (#17)
  3. Click on the green #17
  4. Note how you get a 404 page
  5. Now click on the Pull Requests tab
  6. See how there actually is a PR with number #17
  7. Now if I would enable the issues tab for this repo, step 3 would actually take you to the correct PR page

Gitea Version

1.24.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions