Raw URL Web Request Redirection Loop On Spaces In Filename #2112

Closed
opened 2025-11-02 04:24:31 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @atom0s on GitHub (Jul 29, 2018).

  • Gitea version (or commit ref): a74426d631
  • Git version: 2.17.1.windows.2
  • Operating system: Windows Server 2012 R2 Standard
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant - Doesn't load, still 502 bad gateway error.
  • Log gist:
    N/A

Description

Gitea has issues serving URLs that Gogs otherwise used to server without issue when requesting /raw/ related data from an external source. The issue seems to only trigger for me so far when there is a space in a file name.

For example, on Gogs, both of these are valid but Gogs will offer you the first link when clicking the 'Raw' button to view the file:

https://example.com/SomeOwner/SomeRepo/raw/master/data/Some File Name.xml
https://example.com/SomeOwner/SomeRepo/raw/branch/master/data/Some File Name.xml

Gitea on the other hand gives you the 2nd one instead with the /branch/ part added to the url. On all other files, Gitea will work with either link, except files with spaces in the name so far. (Other special characters may cause issues too, haven't tested anything further than that at the moment.)

Instead, Gitea will get stuck in a redirect loop and eventually error out with:

https://example.com/SomeOwner/SomeRepo/raw/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml

And 404.

Originally created by @atom0s on GitHub (Jul 29, 2018). - Gitea version (or commit ref): a74426d631e3311cc3c460ae9917f76f0221f4de - Git version: 2.17.1.windows.2 - Operating system: Windows Server 2012 R2 Standard - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Doesn't load, still 502 bad gateway error. - Log gist: N/A ## Description Gitea has issues serving URLs that Gogs otherwise used to server without issue when requesting /raw/ related data from an external source. The issue seems to only trigger for me so far when there is a space in a file name. For example, on Gogs, both of these are valid but Gogs will offer you the first link when clicking the 'Raw' button to view the file: ``` https://example.com/SomeOwner/SomeRepo/raw/master/data/Some File Name.xml https://example.com/SomeOwner/SomeRepo/raw/branch/master/data/Some File Name.xml ``` Gitea on the other hand gives you the 2nd one instead with the /branch/ part added to the url. On all other files, Gitea will work with either link, except files with spaces in the name so far. (Other special characters may cause issues too, haven't tested anything further than that at the moment.) Instead, Gitea will get stuck in a redirect loop and eventually error out with: ``` https://example.com/SomeOwner/SomeRepo/raw/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml/branch/master/data/Some%20File%20Name.xml ``` And 404.
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 04:24:31 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jan 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 (Jan 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

@lunny commented on GitHub (Apr 18, 2021):

I think this has been resolved. Please feel free to reopen it.

@lunny commented on GitHub (Apr 18, 2021): I think this has been resolved. Please feel free to reopen it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2112