kenchris / urlpattern-polyfill

URLPattern polyfill
https://www.npmjs.com/package/urlpattern-polyfill
MIT License
267 stars 30 forks source link

Fix matched values for `:name*` patterns. (#126) #56

Closed wanderview closed 2 years ago

wanderview commented 2 years ago

This fixes the problem where:

const p = new URLPattern({ pathname: ':name*' }); const r = p.exec('foobar'); console.log(r.pathname.groups.name);

Would log 'r' instead of 'foobar'.

This is an upstream bug in path-to-regexp:

https://github.com/pillarjs/path-to-regexp/issues/260

This commit essentially applies the proposed fix in:

https://github.com/pillarjs/path-to-regexp/pull/261

And adds the WPT tests from:

https://chromium-review.googlesource.com/c/chromium/src/+/3123654

wanderview commented 2 years ago

@kenchris PTAL