Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text replacing issues in post requests #6655

Closed
2 of 7 tasks
marcsiq opened this issue Apr 16, 2019 · 12 comments · Fixed by #6656
Closed
2 of 7 tasks

Text replacing issues in post requests #6655

marcsiq opened this issue Apr 16, 2019 · 12 comments · Fixed by #6656

Comments

@marcsiq
Copy link

marcsiq commented 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

@zeripath
Copy link
Contributor

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

@marcsiq
Copy link
Author

marcsiq commented 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

@zeripath
Copy link
Contributor

Ah I see! Sorry I just did that!

@marcsiq
Copy link
Author

marcsiq commented Apr 16, 2019

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

@zeripath
Copy link
Contributor

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.

@marcsiq
Copy link
Author

marcsiq commented Apr 16, 2019

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

@zeripath
Copy link
Contributor

OK, so this one is due to:

<form class="ui comment form stackable grid" action="{{EscapePound .Link}}" method="post">

Here the link is being twice escaped.

@zeripath
Copy link
Contributor

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

@marcsiq
Copy link
Author

marcsiq commented Apr 16, 2019

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

@zeripath
Copy link
Contributor

yeah

@marcsiq
Copy link
Author

marcsiq commented 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. 😄

@zeripath
Copy link
Contributor

The other bug I mentioned should be fixed by #6657

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants