fix(@angular/ssr): decode pathname when constructing server asset path - #33970
Open
alan-agius4 wants to merge 1 commit into
Open
fix(@angular/ssr): decode pathname when constructing server asset path#33970alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the SSR application to support non-ASCII routes and base hrefs by decoding URI components using decodeURIComponent with fallback handling. It also introduces comprehensive test coverage for non-ASCII paths. The review feedback suggests extracting a safeDecode helper to reduce code duplication and preserve variable immutability, as well as adding an afterEach hook in the tests to restore the manifest state and ensure proper test isolation.
Ensure that the request pathname is decoded using `decodeURIComponent` when resolving server asset paths in `AngularServerApp`. Previously, `buildServerAssetPathFromRequest` used the raw percent-encoded `pathname` from `new URL(request.url)` while prerendered assets were registered in the manifest under decoded names. Consequently, prerendered routes with non-ASCII or percent-encoded characters failed asset lookup and fell through to server-side rendering or 404. Closes angular#33966
alan-agius4
force-pushed
the
fix-ssr-prerender-non-ascii
branch
from
August 31, 2026 07:41
c0f5ed4 to
9582885
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
AngularAppEngine/AngularServerAppresolves prerendered static assets using the raw percent-encoded pathname fromnew URL(request.url)without decoding. However, during the build, prerendered assets are registered in the manifest under their decoded names (e.g./مقالات/دليل/index.html). For any prerendered route containing non-ASCII characters or percent-encoded characters, asset lookup fails and requests fall back to server-side rendering or 404.Issue Number: Closes #33966
What is the new behavior?
The request pathname is decoded using
decodeURIComponentinbuildServerAssetPathFromRequestbefore looking up the asset inmanifest.assets, ensuring requests for prerendered non-ASCII routes correctly match and serve their prerendered files.Does this PR introduce a breaking change?
Other information