Skip to content

Paths URI-decoded twice #306

@gertsonderby

Description

@gertsonderby

Within Route.match(), there is the following construction:

m = this.regexp.exec(decodeURIComponent(pathname));
//...     
for (var i = 1, len = m.length; i < len; ++i) {
  //...
  var val = decodeURLEncodedURIComponent(m[i]);
  //...
}

As a result, unless the option decodeURLComponents is passed to Page.js, the path is first URI-decoded, and then the individual components are decoded again. As a result, a path which contains a URI-encoded % blows up with an "URIError: URI malformed" message. If the option is passed, the path is decoded, but only before matching, which means that a URI-encoded / confounds the matching.

At a guess, the first decoding is undesirable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions