Skip to content

fix(router): fall back when serializing protocol-relative URLs - #71094

Merged
kirjs merged 1 commit into
angular:mainfrom
atscott:fix/router-relative-url
Oct 2, 2026
Merged

kirjs merged 1 commit into
angular:mainfrom
atscott:fix/router-relative-url

Conversation

@atscott

@atscott atscott commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Avoid throwing when DefaultUrlSerializer encounters a UrlTree that would serialize to a protocol-relative URL. Warn in development mode and serialize the tree with a root-relative path instead while preserving query parameters and fragments.

Additionally, account for WHATWG URL normalization (e.g. dot segments and backslashes collapsing into protocol-relative paths such as /.// or /..//).

Fixes #69700
Fixes #71076

@pullapprove
pullapprove Bot requested review from crisbeto and kirjs September 30, 2026 16:07
@ngbot ngbot Bot added this to the Backlog milestone Sep 30, 2026
@atscott atscott added the target: patch This PR is targeted for the next patch release label Sep 30, 2026
Comment thread packages/router/src/url_tree.ts Outdated
@atscott
atscott force-pushed the fix/router-relative-url branch 2 times, most recently from aa3c990 to e8098db Compare September 30, 2026 16:18
Avoid throwing when DefaultUrlSerializer encounters a UrlTree that would serialize to a protocol-relative URL. Warn in development mode and serialize the tree with a root-relative path instead while preserving query parameters and fragments.

Additionally, account for WHATWG URL normalization (e.g. dot segments and backslashes collapsing into protocol-relative paths such as `/.//` or `/..//`).

Fixes angular#69700
Fixes angular#71076

Co-authored-by: Andrew Scott <atscott01@gmail.com>
@atscott
atscott force-pushed the fix/router-relative-url branch from e8098db to f10507e Compare September 30, 2026 17:14
@atscott
atscott requested a review from alan-agius4 October 1, 2026 15:56
@atscott atscott added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Oct 1, 2026
@pullapprove
pullapprove Bot requested a review from kirjs October 2, 2026 14:21
@kirjs
kirjs merged commit a1bffc2 into angular:main Oct 2, 2026
30 of 34 checks passed
@kirjs

kirjs commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: router target: patch This PR is targeted for the next patch release

Projects

None yet

4 participants