You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b982c02
Browse filesBrowse the repository at this point in the historyBrowse files
* fix(url): stabilize paths with malformed percent escapes
Preserve percent escapes during fallback decoding and prevent malformed escapes from changing meaning after URL serialization, while keeping stable paths such as /100% unchanged.
Check path stability against a fixed HTTP base so an unparsable request authority cannot make getPath throw before error handling.
* fix(mount): safely forward routed paths to mounted apps
Slice the matched mount prefix from the parent routed path, including after route grouping, and preserve backslashes and control characters when rebuilding the request URL.
Reject dot segments and malformed percent encoding or UTF-8 that changes after URL serialization and decoding. Reject ambiguous request URL authorities, and count trailing slashes in the received URL before parsing so non-strict parent and child applications cannot remove different slashes.
Preserve stable malformed paths, valid custom getPath encodings, replaceRequest overrides, and existing configuration errors. Cover both mount APIs with regression tests.
* fix(mount): reject optional regular expression parameters
Reject unsupported optional regular expression parameters as configuration errors before measuring the mount prefix. Previously they were measured as literal route text, allowing certain path lengths to forward an unintended suffix past parent authorization.
Throw Error so the default error handler responds with HTTP 500, consistently with other unsupported mount configurations. Keep HTTP 400 for request paths that cannot be forwarded safely, and update both mount APIs' throws documentation.
Cover short and matching-length inputs, slash-matching patterns, optional parameters in the middle of a route, custom error handling, and both mount APIs with PatternRouter. Verify separate route registrations as the supported workaround.
* remove unused stripPathPrefix
---------
Co-authored-by: Yusuke Wada <[email protected]>
* @param {Function} applicationHandler - other Request Handler
42
42
* @param {MountOptions} [options] - options of `mount()`
43
43
* @returns {MiddlewareHandler} handler to register with `app.all()`
44
-
* @throws {Error} If the route ends with a wildcard inside a segment (e.g. `/assets*`), or automatic request rewriting encounters duplicate path parameter names.
44
+
* @throws {Error} If the route ends with a wildcard inside a segment (e.g. `/assets*`), or automatic request rewriting encounters duplicate path parameter names or an optional regular expression parameter.
45
+
* @throws {HTTPException} With status 400 if automatic request rewriting cannot safely preserve the routed path.
0 commit comments