404 error on View File for Commits with Spaces in File/Folder #6010

Closed
opened 2025-11-02 06:42:42 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Svra44 on GitHub (Sep 16, 2020).

  • Gitea version (or commit ref): 1.12.4
  • Git version: 2.20.1
  • Operating system: Debian 10.5
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

gitea[10132]: [Macaron] 2020-09-16 22:45:50: Started GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/th for 192.168.0.10
gitea[10132]: [Macaron] 2020-09-16 22:45:50: Completed GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/th 404 Not Found in 4.921573ms

gitea[10132]: [Macaron] 2020-09-16 22:48:26: Started GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/file%20with%20spaces.txt for 127.0.0.1
gitea[10132]: [Macaron] 2020-09-16 22:48:26: Completed GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/file%20with%20spaces.txt 200 OK in 7.585426ms

Description

Gitea appears to incorrectly handle the "View File" option when viewing commits to files with spaces either in the file name, or in the containing directory structure.
Have tested in both FF 80.0.1 & Chromium 85.0.4183.102

When accessing a commit view, & selecting the "View File" option, it redirects to an incorrect link.
Example:

Tested directly against gitea localhost:3000 bind, taking reverse proxy out of the chain.
Same git repo uploaded to try.gitea.io doesnt exhibit the same issue.

Screenshots

image
image
image

Originally created by @Svra44 on GitHub (Sep 16, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.12.4 - Git version: 2.20.1 - Operating system: Debian 10.5 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: gitea[10132]: [Macaron] 2020-09-16 22:45:50: Started GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/th for 192.168.0.10 gitea[10132]: [Macaron] 2020-09-16 22:45:50: Completed GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/th 404 Not Found in 4.921573ms gitea[10132]: [Macaron] 2020-09-16 22:48:26: Started GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/file%20with%20spaces.txt for 127.0.0.1 gitea[10132]: [Macaron] 2020-09-16 22:48:26: Completed GET /TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/file%20with%20spaces.txt 200 OK in 7.585426ms ## Description Gitea appears to incorrectly handle the "View File" option when viewing commits to files with spaces either in the file name, or in the containing directory structure. Have tested in both FF 80.0.1 & Chromium 85.0.4183.102 When accessing a commit view, & selecting the "View File" option, it redirects to an incorrect link. Example: - Filename: "file with spaces.txt" - "View File" link: http://127.0.0.1:3000/TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/th -- Result: 404 - Correct Link: http://127.0.0.1:3000/TestUser1/tmpGit/src/commit/23bfc188a8d3fed0156640551136192fbe2588d7/file%20with%20spaces.txt -- Result: 200 (page loads fine when manually browsing to this link) Tested directly against gitea localhost:3000 bind, taking reverse proxy out of the chain. Same git repo uploaded to try.gitea.io doesnt exhibit the same issue. ## Screenshots ![image](https://user-images.githubusercontent.com/49822387/93396748-0f9a0880-f870-11ea-8578-8715ea0314e3.png) ![image](https://user-images.githubusercontent.com/49822387/93396802-28a2b980-f870-11ea-99b3-f284e462256b.png) ![image](https://user-images.githubusercontent.com/49822387/93396905-656eb080-f870-11ea-9013-35c26f656f0b.png)
GiteaMirror added the type/bug label 2025-11-02 06:42:42 -06:00
Author
Owner

@mrsdizzie commented on GitHub (Sep 17, 2020):

Duplicate of #12768 and should be fixed in 1.12.5 by #12776

@mrsdizzie commented on GitHub (Sep 17, 2020): Duplicate of #12768 and should be fixed in 1.12.5 by #12776
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6010