404 when accessing commits instead of commit with 7-digit hash #2917

Closed
opened 2025-11-02 04:53:57 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Aragur on GitHub (Feb 15, 2019).

Description

When you access a commit with it's 7 digit hash and you use the plural of commit (commits) Gitea will redirect you to/commits/branch/master/{hash} which will result in a 404.
Example working URL:
https://try.gitea.io/AragurDEV/Test1234/commit/d375de4
Example broken URL:
https://try.gitea.io/AragurDEV/Test1234/commits/d375de4

root@system: ~ $ curl --head https://try.gitea.io/AragurDEV/Test1234/commits/d375de4
HTTP/2 302 
content-type: text/html; charset=utf-8
date: Fri, 15 Feb 2019 00:24:48 GMT
location: /AragurDEV/Test1234/commits/branch/master/d375de4
set-cookie: lang=en-US; Path=/; Max-Age=2147483647
set-cookie: i_like_gitea=11fb8d1072e778c1; Path=/; HttpOnly
set-cookie: _csrf=dScV8YPxCkDN0tRkNJRUEfWPLi06MTU1MDE5MDI4ODk4NTkxNjc4OQ%3D%3D; Path=/; Expires=Sat, 16 Feb 2019 00:24:48 GMT; HttpOnly
x-frame-options: SAMEORIGIN

Side note: this is used in nearly every changelog generator :)

Expected behavior

Handle 'commits' as 'commit' and show the commit :)

Originally created by @Aragur on GitHub (Feb 15, 2019). - Gitea version (or commit ref): 7ae5956 - Git version: 2.20.1 - Can you reproduce the bug at https://try.gitea.io: - [X] Yes: https://try.gitea.io/AragurDEV/Test1234 ## Description When you access a commit with it's 7 digit hash and you use the plural of commit (commits) Gitea will redirect you to`/commits/branch/master/{hash}` which will result in a 404. Example working URL: https://try.gitea.io/AragurDEV/Test1234/commit/d375de4 Example broken URL: https://try.gitea.io/AragurDEV/Test1234/commits/d375de4 ``` root@system: ~ $ curl --head https://try.gitea.io/AragurDEV/Test1234/commits/d375de4 HTTP/2 302 content-type: text/html; charset=utf-8 date: Fri, 15 Feb 2019 00:24:48 GMT location: /AragurDEV/Test1234/commits/branch/master/d375de4 set-cookie: lang=en-US; Path=/; Max-Age=2147483647 set-cookie: i_like_gitea=11fb8d1072e778c1; Path=/; HttpOnly set-cookie: _csrf=dScV8YPxCkDN0tRkNJRUEfWPLi06MTU1MDE5MDI4ODk4NTkxNjc4OQ%3D%3D; Path=/; Expires=Sat, 16 Feb 2019 00:24:48 GMT; HttpOnly x-frame-options: SAMEORIGIN ``` Side note: this is used in nearly every changelog generator :) #### Expected behavior Handle 'commits' as 'commit' and show the commit :)
GiteaMirror added the issue/confirmed label 2025-11-02 04:53:57 -06:00
Author
Owner

@Aragur commented on GitHub (Feb 15, 2019):

Okay I was a bit wrong:
Github handles it by showing a all commits to the specified commit for example: https://github.com/go-gitea/gitea/commits/7ae5956

@Aragur commented on GitHub (Feb 15, 2019): Okay I was a bit wrong: Github handles it by showing a all commits to the specified commit for example: https://github.com/go-gitea/gitea/commits/7ae5956
Author
Owner

@stale[bot] commented on GitHub (Apr 16, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 16, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@wxiaoguang commented on GitHub (Apr 15, 2025):

commits is not commit:

Image

@wxiaoguang commented on GitHub (Apr 15, 2025): `commits` is not `commit`: ![Image](https://github.com/user-attachments/assets/eca28550-3094-490a-85b3-403753bc3864)
Author
Owner
@wxiaoguang commented on GitHub (Apr 15, 2025): * https://gitea.com/gitea/gitea-mirror/commit/921d3a3 * https://gitea.com/gitea/gitea-mirror/commits/commit/921d3a3
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2917