fix(linear-router): don't match an empty path segment as a param (#5373)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix(linear-router): don't match an empty path segment as a param `/u/:id/posts` matched `/u//posts` and set `id` to an empty string. RegExpRouter, TrieRouter and PatternRouter all return 404 for that path. The value extraction already rejected an empty segment at the end of the path, but not one in the middle: `path.indexOf('/', pos + 1)` returns `pos + 1` for `//`, so the slice was empty and the match continued. Rejects the mid-path case the same way, and adds the case to the shared suite where all four routers pass it. * refactor: reject an empty param value in one place ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
Diff stats
2 files+21 added−3 removed
- tests:+17 added−0 removed
- other:+4 added−3 removed