fix: fix URL path value still unescaped when UnescapePathValues set false

Closes #4033
This commit is contained in:
jimchen 2024-08-20 18:12:40 +08:00
parent cc4e11438c
commit bf6728e53b
2 changed files with 2 additions and 2 deletions

2
gin.go
View File

@ -645,7 +645,7 @@ func (engine *Engine) HandleContext(c *Context) {
func (engine *Engine) handleHTTPRequest(c *Context) { func (engine *Engine) handleHTTPRequest(c *Context) {
httpMethod := c.Request.Method httpMethod := c.Request.Method
rPath := c.Request.URL.Path rPath := c.Request.URL.EscapedPath()
unescape := false unescape := false
if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 { if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 {
rPath = c.Request.URL.RawPath rPath = c.Request.URL.RawPath

View File

@ -242,7 +242,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
return func(c *Context) { return func(c *Context) {
// Start timer // Start timer
start := time.Now() start := time.Now()
path := c.Request.URL.Path path := c.Request.URL.EscapedPath()
raw := c.Request.URL.RawQuery raw := c.Request.URL.RawQuery
// Process request // Process request