Skip to content

broken auto-decoding urlencoded named path parameters #878

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

Closed
mr-tron opened this issue Mar 15, 2017 · 4 comments
Closed

broken auto-decoding urlencoded named path parameters #878

mr-tron opened this issue Mar 15, 2017 · 4 comments
Assignees
Labels

Comments

@mr-tron
Copy link

mr-tron commented Mar 15, 2017

Description

Checklist

  • [ +] Dependencies installed
  • [ +] No typos
  • [ +] Searched existing issues and docs

Expected behaviour

Actual behaviour

c.Param("s") don't decode param if it encoded with urlencode

Steps to reproduce

Working code to debug

package main
import (
"github.com/labstack/echo"
"fmt"
)

func handler(c echo.Context) error {
  s := c.Param("s")
  fmt.Println(s)
return nil
}
func main() {
e := echo.New()
e.GET("/:s", handler)
e.Start(":9090")
}

curl 'http://localhost:9090/ыыыы'
in stdout you can see %D1%8B%D1%8B%D1%8B%D1%8B (not ыыыы as expected)

Version/commit

1f0bae3 - in this version worked
I didn't search commit there it was broken.

@mr-tron
Copy link
Author

mr-tron commented Mar 15, 2017

i think #839 is the same problem

@vishr
Copy link
Member

vishr commented Mar 15, 2017

Related: #766

@vishr vishr self-assigned this Mar 15, 2017
@vishr vishr added bug question and removed bug labels Mar 15, 2017
@vishr
Copy link
Member

vishr commented Mar 15, 2017

@mr-tron This has been discussed many times in the above mentioned issues and finally we decided to move the unescaping logic for any kind of parameter outside the framework. So in your case you can simply unescape the parameter using url.QueryUnescape(c.Param("s")). Don't hesitate to continue the discussion.

@vishr vishr closed this as completed Mar 15, 2017
vishr added a commit that referenced this issue Mar 15, 2017
Signed-off-by: Vishal Rana <[email protected]>
@vishr
Copy link
Member

vishr commented Mar 15, 2017

Okay, we got it resolved in b2430fc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants