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

Reserved characters should not be percent-encoded #7

Closed
ghost opened this issue Feb 7, 2015 · 3 comments · Fixed by #9
Closed

Reserved characters should not be percent-encoded #7

ghost opened this issue Feb 7, 2015 · 3 comments · Fixed by #9

Comments

@ghost
Copy link

ghost commented Feb 7, 2015

purell should not normalize reserved characters, as per RFC3986:

  reserved    = gen-delims / sub-delims

  gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

  sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="
package main

import (
    "fmt"

    "github.com/PuerkitoBio/purell"
)

func main() {
    fmt.Println(purell.MustNormalizeURLString("my_(url)", purell.FlagsSafe))
}

The above code outputs my_%28url%29, whereas it should be my_(url). This is due to a bug in Go stdlib (issue 5684).

@mna
Copy link
Member

mna commented Feb 7, 2015

Totally agree, but as you mention, this is due to the parsing and escaping done by Go's stdlib. Once/if the bug is fixed in Go, this will be fixed too. Not a purell bug per se.

@mna mna closed this as completed Feb 7, 2015
@ghost
Copy link
Author

ghost commented Feb 8, 2015

I believe that purell should use its own implementation of url.Parse/url.String and not rely on the buggy stdlib.

@mna
Copy link
Member

mna commented Feb 8, 2015

Pull requests welcome.

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

Successfully merging a pull request may close this issue.

1 participant