Skip to content

html/template: stateURL context percent encodes "(", ")" yet they are valid path characters #15891

@gmccue

Description

@gmccue

The html/template context stateURL appears to be percent encoding valid characters. I believe this is because shouldEscape() in net/url encodes these characters by default: https://github.com/ecosia/go/blob/master/src/net/url/url.go#L101

RFC3986 allows for the use of ( and ) characters in the query component: https://tools.ietf.org/html/rfc3986#section-3.4

  1. What version of Go are you using (go version)?
    1.6.2
  2. What operating system and processor architecture are you using (go env)?
    linux/amd64
  3. What did you do?
    Create a template with a variable to be used for the href attribute. Pass a URL including ( or ) to the template and compile. ( and ) are percent encoded during compilation.
    An example on play.golang.org: https://play.golang.org/p/QFtR42GyfI
  4. What did you expect to see?
    <a href="http://my.domain/path-to-lang(en)">Click this link.</a>
  5. What did you see instead?
    <a href="http://my.domain/path-to-lang%28en%29">Click this link.</a>

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions