Skip to content

refactor(platform-server): clean up and simplify parseUrl utility#68983

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:refactor-url-building-cleanup
Open

refactor(platform-server): clean up and simplify parseUrl utility#68983
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:refactor-url-building-cleanup

Conversation

@alan-agius4
Copy link
Copy Markdown
Contributor

Trims leading/trailing whitespaces in parseUrl to normalize input.

Leverages the native new URL() constructor with a non-standard base (resolve://) under strict mode to detect and reject malformed absolute targets (like double ports) during bootstrap, rather than raw regular expressions.

Preserves relative sub-paths safely by only collapsing consecutive leading slashes/backslashes when a slash is present, ensuring trailing-slash contexts are resolved properly against parent domains.

Adds and updates comprehensive unit tests covering all relative pathing, malformed structures, and potential hijacking edge cases.

@angular-robot angular-robot Bot added the area: server Issues related to server-side rendering label May 28, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 28, 2026
@alan-agius4 alan-agius4 force-pushed the refactor-url-building-cleanup branch from cbc32af to 2a31fb4 Compare May 28, 2026 12:09
@alan-agius4 alan-agius4 requested a review from JeanMeche May 28, 2026 12:13
@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label May 28, 2026
@alan-agius4 alan-agius4 force-pushed the refactor-url-building-cleanup branch 4 times, most recently from 521b25e to 2768415 Compare May 28, 2026 12:29
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 28, 2026
@alan-agius4 alan-agius4 force-pushed the refactor-url-building-cleanup branch from 2768415 to 8be0b85 Compare May 28, 2026 12:33
Trims leading/trailing whitespaces in resolveUrl to normalize input.

Leverages the native new URL() constructor with a non-standard base (resolve://) under strict mode to detect and reject malformed absolute targets (like double ports) during bootstrap, rather than raw regular expressions.

Preserves relative sub-paths safely by only collapsing consecutive leading slashes/backslashes when a slash is present, ensuring trailing-slash contexts are resolved properly against parent domains.

Adds and updates comprehensive unit tests covering all relative pathing, malformed structures, and potential hijacking edge cases.
@alan-agius4 alan-agius4 force-pushed the refactor-url-building-cleanup branch from 8be0b85 to 1f3725e Compare May 28, 2026 12:35
@alan-agius4 alan-agius4 marked this pull request as ready for review May 28, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: server Issues related to server-side rendering target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant