-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Fix URL path value still unescaped when UnescapePathValues set false #4036
base: master
Are you sure you want to change the base?
Conversation
@@ -242,7 +242,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc { | |||
return func(c *Context) { | |||
// Start timer | |||
start := time.Now() | |||
path := c.Request.URL.Path | |||
path := c.Request.URL.EscapedPath() |
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.
gin.go
Outdated
@@ -645,7 +645,7 @@ func (engine *Engine) HandleContext(c *Context) { | |||
|
|||
func (engine *Engine) handleHTTPRequest(c *Context) { | |||
httpMethod := c.Request.Method | |||
rPath := c.Request.URL.Path | |||
rPath := c.Request.URL.EscapedPath() |
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.
This should not be changed right?
Now we are always routing based on the EscapedPath
which changes the default behaviour
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.
This should not be changed right? Now we are always routing based on the
EscapedPath
which changes the default behaviour
You are right.
gin.go
Outdated
rPath := c.Request.URL.EscapedPath() | ||
unescape := false | ||
if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 { | ||
rPath = c.Request.URL.RawPath |
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.
rPath := c.Request.URL.EscapedPath() | |
unescape := false | |
if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 { | |
rPath = c.Request.URL.RawPath | |
rPath := c.Request.URL.Path | |
unescape := false | |
if engine.UseRawPath { | |
rPath = c.Request.URL.EscapedPath() |
Closes #4033