Text replacing issues in post requests #3202

Closed
opened 2025-11-02 05:03:44 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @marcsiq on GitHub (Apr 16, 2019).

  • Gitea version (or commit ref): 1.8
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04.2
  • 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:

Description

https://try.gitea.io/marcs/bug_test/compare/master...issue%232

If we try to pull-request branch "issue#N" into "master" we got error 404.
We can see from the log on our own server (caption below) that the issue is with the post request text replacing %23N (#N) by %2523N.

...

Screenshots

Apr 16 17:15:02 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:02: Started GET /DSP/Prometheus/compare/develop...feature/issue%235 for 127.0.0.1
Apr 16 17:15:02 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:02: Completed GET /DSP/Prometheus/compare/develop...feature/issue%235 200 OK in 190.126663ms
Apr 16 17:15:06 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:06: Started POST /DSP/Prometheus/compare/develop...feature/issue%25235 for [::1]
Apr 16 17:15:06 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:06: Completed POST /DSP/Prometheus/compare/develop...feature/issue%25235 404 Not Found in 53.722988ms

Originally created by @marcsiq on GitHub (Apr 16, 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.8 - Git version: 2.17.1 - Operating system: Ubuntu 18.04.2 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant - Log gist: ## Description https://try.gitea.io/marcs/bug_test/compare/master...issue%232 If we try to pull-request branch "issue#N" into "master" we got error 404. We can see from the log on our own server (caption below) that the issue is with the post request text replacing %23N (#N) by %2523N. ... ## Screenshots Apr 16 17:15:02 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:02: Started GET /DSP/Prometheus/compare/develop...feature/issue%235 for 127.0.0.1 Apr 16 17:15:02 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:02: Completed GET /DSP/Prometheus/compare/develop...feature/issue%235 200 OK in 190.126663ms Apr 16 17:15:06 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:06: Started POST /DSP/Prometheus/compare/develop...feature/issue%25235 for [::1] Apr 16 17:15:06 rd1 gitea[19212]: [Macaron] 2019-04-16 17:15:06: Completed POST /DSP/Prometheus/compare/develop...feature/issue%25235 404 Not Found in 53.722988ms <!-- **If this issue involves the Web Interface, please include a screenshot** -->
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

Hmm on try that appears to be working. Could you attempt to replicate on try?

@zeripath commented on GitHub (Apr 16, 2019): Hmm on try that appears to be working. Could you attempt to replicate on try?
Author
Owner

@marcsiq commented on GitHub (Apr 16, 2019):

https://try.gitea.io/marcs/bug_test/compare/master...issue%232

If you just try to create a pull request to merge "issue#2" into "master" i got a error 404

@marcsiq commented on GitHub (Apr 16, 2019): https://try.gitea.io/marcs/bug_test/compare/master...issue%232 If you just try to create a pull request to merge "issue#2" into "master" i got a error 404
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

Ah I see! Sorry I just did that!

@zeripath commented on GitHub (Apr 16, 2019): Ah I see! Sorry I just did that!
Author
Owner

@marcsiq commented on GitHub (Apr 16, 2019):

And if you look at the URL when getting the error it replaces %232 (which represents #2 correctly) with %25232.

@marcsiq commented on GitHub (Apr 16, 2019): And if you look at the URL when getting the error it replaces %232 (which represents #2 correctly) with %25232.
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

I just noticed another issue try creating a file using the editor with a new branch say #3. You're redirected to something awful too.

@zeripath commented on GitHub (Apr 16, 2019): I just noticed another issue try creating a file using the editor with a new branch say #3. You're redirected to something awful too.
Author
Owner

@marcsiq commented on GitHub (Apr 16, 2019):

Yeah, we also saw that problem! So it suggests it's somewhere in http text replacement.

@marcsiq commented on GitHub (Apr 16, 2019): Yeah, we also saw that problem! So it suggests it's somewhere in http text replacement.
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

OK, so this one is due to:

8d01b9857f/templates/repo/issue/new_form.tmpl (L1)

Here the link is being twice escaped.

@zeripath commented on GitHub (Apr 16, 2019): OK, so this one is due to: https://github.com/go-gitea/gitea/blob/8d01b9857ffeb1408b3fe6ca2007de5a81eaacd6/templates/repo/issue/new_form.tmpl#L1 Here the link is being twice escaped.
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

I'm fairly certain that that should never need to be EscapePounded

@zeripath commented on GitHub (Apr 16, 2019): I'm fairly certain that that should never need to be EscapePounded
Author
Owner

@marcsiq commented on GitHub (Apr 16, 2019):

So, creating that template under /custom/templates/repo/issue and remove the escaping should do the trick?

@marcsiq commented on GitHub (Apr 16, 2019): So, creating that template under `/custom/templates/repo/issue` and remove the escaping should do the trick?
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

yeah

@zeripath commented on GitHub (Apr 16, 2019): yeah
Author
Owner

@marcsiq commented on GitHub (Apr 16, 2019):

I'm gonna try it tomorrow then.
Thank you so much, I'm quite new on gitea but loving it so far. 😄

@marcsiq commented on GitHub (Apr 16, 2019): I'm gonna try it tomorrow then. Thank you so much, I'm quite new on gitea but loving it so far. 😄
Author
Owner

@zeripath commented on GitHub (Apr 16, 2019):

The other bug I mentioned should be fixed by #6657

@zeripath commented on GitHub (Apr 16, 2019): The other bug I mentioned should be fixed by #6657
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3202