Skip to content

fix(@angular/ssr): preserve trailing slashes in query and fragment of redirect URLs - #34512

Open
alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:fix/ssr-redirect-query-trailing-slash
Open

alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:fix/ssr-redirect-query-trailing-slash

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

In redirect URLs, trailing slashes in query parameters or hash fragments should be preserved, while the path portion before the query or fragment continues to be normalized.

Fixes #34511

@alan-agius4
alan-agius4 requested a review from dgp1130 October 23, 2026 17:47
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release target: patch This PR is targeted for the next patch release and removed target: minor This PR is targeted for the next minor release labels Oct 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the joinUrlParts utility function to correctly preserve trailing slashes within query parameters and URL fragments, ensuring they are not inadvertently stripped during URL normalization. The changes include logic to identify and isolate query and hash segments before processing the path, along with comprehensive test cases in url_spec.ts, app_spec.ts, and ng-routes_spec.ts to verify the fix. I have provided a suggestion to simplify the logic used to identify the suffix index for better readability.

Comment thread packages/angular/ssr/src/utils/url.ts Outdated
… redirect URLs

In redirect URLs, trailing slashes in query parameters or hash fragments
should be preserved, while the path portion before the query or fragment
continues to be normalized.

Fixes angular#34511
@alan-agius4
alan-agius4 force-pushed the fix/ssr-redirect-query-trailing-slash branch from 096750d to a77eadd Compare October 23, 2026 18:28
Comment thread packages/angular/ssr/src/utils/url.ts Outdated
@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 Oct 24, 2026
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: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ssr: string redirectTo drops trailing slash in query and fragment

2 participants