Skip to content

broken auto-decoding urlencoded named path parameters #878

Closed

Description

@mr-tron

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.

Activity

  1. mr-tron commented on Mar 15, 2017

    @mr-tron
    Author

    i think #839 is the same problem

  2. vishr commented on Mar 15, 2017

    @vishr
    Member

    Related: #766

  3. self-assigned this
    on Mar 15, 2017
  4. vishr commented on Mar 15, 2017

    @vishr
    Member

    @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.

  5. added a commit that references this issue on Mar 15, 2017
    b2430fc
  6. vishr commented on Mar 15, 2017

    @vishr
    Member

    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions