whatwg / urlpattern

URL Pattern Standard
https://urlpattern.spec.whatwg.org/
Other
157 stars 22 forks source link

URLPattern: Emit '{ }' when there is a preceding non-prefix '/'. (#145) #155

Closed wanderview closed 2 years ago

wanderview commented 2 years ago

This commit fixes another issue from #145.

In this case we want to make sure that a character that can be treated as an implicit group prefix, e.g. /, is not incorrectly converted into a prefix. For example, if the original string is /{:foo?} we don't want to generate /:foo? since that would make the / optional.

This CL also includes an additional fix that permits emitting * for wildcards when there is a prefix. Previously we were being too conservative in some situations. For example, we can emit */* instead of */(.*).

This commit corresponds to this implementation change:

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


Preview | Diff

wanderview commented 2 years ago

@domenic PTAL. This is for another string generation issue found by the fuzzer. The implementation CL has not landed yet.

wanderview commented 2 years ago

Good catch! I refactored the spec logic to look more like the implementation and added the missing changes. PTAL.