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

Closed
opened 2025-11-02 11:26:01 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @DrMaxNix on GitHub (Sep 5, 2025).

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

Originally created by @DrMaxNix on GitHub (Sep 5, 2025). ### 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
GiteaMirror added the type/bug label 2025-11-02 11:26:01 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14928