Commit 53b9623
committed
fix(@angular/ssr): decode route segments when building and matching route tree
Updates the `getPathSegments` method in `RouteTree` to decode each path segment using `decodeURIComponent` after splitting the route by `/`.
This ensures that encoded characters in URL segments (such as spaces or encoded slashes) are correctly interpreted when matching incoming requests against the route tree. This prevents issues where encoded segments would fail to match their corresponding route definitions or wildcard patterns in the tree.
Also reverts experimental changes in `url.ts` and `router.ts` regarding matrix parameter handling, as the simple change in `route-tree.ts` is sufficient to resolve the issue and passes all tests.
Adds a test in `router_spec.ts` to verify that a URL with an encoded parameter containing spaces and slashes (`Bob%20%2F%20Roberts`) correctly matches a wildcard route (`/user/*`).
Fixes angular#330441 parent c34c569 commit 53b9623
3 files changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
130 | 140 | | |
131 | 141 | | |
0 commit comments