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

Fix URL path value still unescaped when UnescapePathValues set false #4036

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
httpMethod := c.Request.Method
rPath := c.Request.URL.Path
unescape := false
if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 {
rPath = c.Request.URL.RawPath
if engine.UseRawPath {
rPath = c.Request.URL.EscapedPath()
unescape = engine.UnescapePathValues
}

Expand Down
2 changes: 1 addition & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

using Path it seem something wrong in this case.

raw := c.Request.URL.RawQuery

// Process request
Expand Down