-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Instead of using routerCtx just escape the url before routing #18086
Instead of using routerCtx just escape the url before routing #18086
Conversation
A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviours too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## main #18086 +/- ##
==========================================
+ Coverage 44.87% 44.88% +0.01%
==========================================
Files 824 824
Lines 91511 91559 +48
==========================================
+ Hits 41068 41100 +32
- Misses 43855 43864 +9
- Partials 6588 6595 +7
Continue to review full report at Codecov.
|
Signed-off-by: Andrew Thornton <art27@cantab.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing req.URL.RawPath
seems strange, but not bad.
…ea#18086) Backport go-gitea#18086 A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <art27@cantab.net>
#18098) Backport #18086 A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing #18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix #17938 Fix #18060 Replace #18062 Replace #17997 Signed-off-by: Andrew Thornton <art27@cantab.net>
* BUGFIXES * Revert "Fix delete u2f keys bug (go-gitea#18042)" (go-gitea#18107) * Migrating wiki don't require token, so we should move it out of the require form (go-gitea#17645) (go-gitea#18104) * Prevent NPE if gitea uploader fails to open url (go-gitea#18080) (go-gitea#18101) * Reset locale on login (go-gitea#17734) (go-gitea#18100) * Correctly handle failed migrations (go-gitea#17575) (go-gitea#18099) * Instead of using routerCtx just escape the url before routing (go-gitea#18086) (go-gitea#18098) * Quote references to the user table in consistency checks (go-gitea#18072) (go-gitea#18073) * Add NotFound handler (go-gitea#18062) (go-gitea#18067) * Ensure that git repository is closed before transfer (go-gitea#18049) (go-gitea#18057) * Use common sessioner for API and web routes (go-gitea#18114) * TRANSLATION * Fix code search result hint on zh-CN (go-gitea#18053) Signed-off-by: Andrew Thornton <art27@cantab.net>
* BUGFIXES * Revert "Fix delete u2f keys bug (#18042)" (#18107) * Migrating wiki don't require token, so we should move it out of the require form (#17645) (#18104) * Prevent NPE if gitea uploader fails to open url (#18080) (#18101) * Reset locale on login (#17734) (#18100) * Correctly handle failed migrations (#17575) (#18099) * Instead of using routerCtx just escape the url before routing (#18086) (#18098) * Quote references to the user table in consistency checks (#18072) (#18073) * Add NotFound handler (#18062) (#18067) * Ensure that git repository is closed before transfer (#18049) (#18057) * Use common sessioner for API and web routes (#18114) * TRANSLATION * Fix code search result hint on zh-CN (#18053) Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
…ea#18086) A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing go-gitea#18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix go-gitea#17938 Fix go-gitea#18060 Replace go-gitea#18062 Replace go-gitea#17997 Signed-off-by: Andrew Thornton <art27@cantab.net>
A consequence of forcibly setting the RoutePath to the escaped url is that the
auto routing to endpoints without terminal slashes fails (Causing #18060.) This
failure raises the possibility that forcibly setting the RoutePath causes other
unexpected behaviours too.
Therefore, instead we should simply pre-escape the URL in the process registering
handler. Then the request URL will be properly escaped for all the following calls.
Fix #17938
Fix #18060
Replace #18062
Replace #17997
Signed-off-by: Andrew Thornton art27@cantab.net