Skip to content

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

Merged
pkozlowski-opensource merged 2 commits into
angular:mainfrom
alan-agius4:refactor-url-building-cleanup
May 29, 2026
Merged

refactor(platform-server): clean up and simplify parseUrl utility#68983
pkozlowski-opensource merged 2 commits 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
Comment thread packages/platform-server/src/url.ts Outdated
@alan-agius4
alan-agius4 force-pushed the refactor-url-building-cleanup branch from ca8cdc6 to 3e63114 Compare May 29, 2026 08:38
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 29, 2026
@pkozlowski-opensource
pkozlowski-opensource merged commit e14d34e into angular:main May 29, 2026
24 checks passed
@pkozlowski-opensource

Copy link
Copy Markdown
Member

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

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jun 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker 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.

3 participants