whatwg/urlpattern

pathnames starting with `./` immediately follow by a matching group can result in double-slash

Opened this issue · 1 comments

Consider this new URLPattern({ pathname: './*', baseURL: self.location }) evaluated on a page at /index.html'. The resulting pathname is //*` which is somewhat unexpected.

This occurs because the / preceding the * is treated as an implicit prefix. This causes the pathname encoder to see just /. which is collapsed to /. Then the /* is appended to get //*.

Authors can workaround this issue for this specific case one of two ways:

  1. new URLPattern({ pathname: './{*}', baseURL: self.location }); or
  2. new URLPattern({ pathname: '*', baseURL: self.location })

I don't have a good idea on how to fix this in the algorithm at the moment.

See also #156.