404 On Pull Request when branch has plus character #3051

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

Originally created by @fubarwrangler on GitHub (Mar 14, 2019).

Description

If you have a branch with a plus sign in it (haven't tried other characters) which is legal in git (my client in Fedora didn't complain -- a colleague had a branch with 'c++' in the name), you can't make a pull request: as soon as you select the branch with the + in the name you get a 404.
...

Screenshots

Screenshot_20190314_153617
--> (click on test++)
Screenshot_20190314_153809

Originally created by @fubarwrangler on GitHub (Mar 14, 2019). <!-- 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.7.4 - Git version: 2.9.5 (on server) - Operating system: RHEL7 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) https://try.gitea.io/TestGanization/testando/compare/master...willsk:test++ - [ ] No - [ ] Not relevant - Log gist: ## Description If you have a branch with a plus sign in it (haven't tried other characters) which is legal in git (my client in Fedora didn't complain -- a colleague had a branch with 'c++' in the name), you can't make a pull request: as soon as you select the branch with the + in the name you get a 404. ... ## Screenshots ![Screenshot_20190314_153617](https://user-images.githubusercontent.com/652980/54386315-0c1c3480-466f-11e9-86a9-32e64109071b.png) --> (click on test++) ![Screenshot_20190314_153809](https://user-images.githubusercontent.com/652980/54386438-543b5700-466f-11e9-8c36-ff5941d00bbb.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 04:58:58 -06:00
Author
Owner

@zeripath commented on GitHub (Mar 14, 2019):

See #6302 - I've listed a number of ways that the compare url is broken.

That being said rather than mark this issue as a duplicate - We could use this issue as the sub issue for dealing with url decomposition and creation affecting compare.

(There's several subissues to #6302 - including the actual issue that causes it which as yet is unidentified.)

@zeripath commented on GitHub (Mar 14, 2019): See #6302 - I've listed a number of ways that the compare url is broken. That being said rather than mark this issue as a duplicate - We could use this issue as the sub issue for dealing with url decomposition and creation affecting compare. (There's several subissues to #6302 - including the actual issue that causes it which as yet is unidentified.)
Author
Owner

@mrsdizzie commented on GitHub (Mar 14, 2019):

It looks like this problem comes from:

7884353a04/routers/repo/pull.go (L636)

QueryUnescape will turn a literal + into a blank space. Heres a test:
https://play.golang.org/p/i19lnB9Q7-M

I think we might want PathUnescape here:
https://golang.org/src/net/url/url.go?s=5107:5151#L173
Based on

// PathUnescape is identical to QueryUnescape except that it does not
// unescape '+' to ' ' (space).
@mrsdizzie commented on GitHub (Mar 14, 2019): It looks like this problem comes from: https://github.com/go-gitea/gitea/blob/7884353a04dfcb1e03b4b26801dc90e7d0d67a5b/routers/repo/pull.go#L636 QueryUnescape will turn a literal + into a blank space. Heres a test: https://play.golang.org/p/i19lnB9Q7-M I think we might want PathUnescape here: https://golang.org/src/net/url/url.go?s=5107:5151#L173 Based on ``` // PathUnescape is identical to QueryUnescape except that it does not // unescape '+' to ' ' (space). ```
Author
Owner

@lunny commented on GitHub (Mar 16, 2019):

If this is duplicated with #6302 , I think we can close this one.

@lunny commented on GitHub (Mar 16, 2019): If this is duplicated with #6302 , I think we can close this one.
Author
Owner

@mrsdizzie commented on GitHub (Mar 16, 2019):

This issue is separate and has a specific known cause (which will be fixed with PR #6334)

@mrsdizzie commented on GitHub (Mar 16, 2019): This issue is separate and has a specific known cause (which will be fixed with PR #6334)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3051