You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably related to that gin sometimes routes request based on either URL.Path or URL.RawPath when UseRawPath is true. URL.RawPath is not always populated (See golang/go#33596), so when it is missing, it falls back to route on URL.Path instead. To me, gin should not fall back to using URL.Path since this path is unescaped, and not raw when UseRawPath is enabled.
Description
Even despite setting
the URL path value is still unescaped.
This is probably related to that gin sometimes routes request based on either
URL.Path
orURL.RawPath
whenUseRawPath
is true.URL.RawPath
is not always populated (See golang/go#33596), so when it is missing, it falls back to route onURL.Path
instead. To me, gin should not fall back to usingURL.Path
since this path is unescaped, and not raw whenUseRawPath
is enabled.Reference:
gin/gin.go
Lines 650 to 653 in cc4e114
To fix this issue, gin should use URL.EscapedPath() which should return
URL.RawPath
if it is non empty, or compute an escaped path if it is empty.It is possible to work around this issue by ensuring that
URL.RawPath
always exists when the gin router handles the request.Example Workaround
How to reproduce
Expectations
Actual result
Environment
The text was updated successfully, but these errors were encountered: