Commit c238bd2
fix(router): handle outlet named __proto__ in segment group maps
Outlet maps are keyed by names read verbatim from the url, so a name like
`__proto__` (e.g. `/one(__proto__:two)`) is assigned through the inherited
`__proto__` setter instead of creating an outlet. This drops the outlet and
mutates the map's prototype, and throws under Node's `--disable-proto=throw`.
Build these outlet maps with `Object.create(null)` so `__proto__` is treated as
an ordinary key. Covers `parseParens` and `squashSegmentGroup` in url_tree.ts,
`createSegmentGroup` in apply_redirects.ts, and `replaceSegment` and
`updateSegmentGroupChildren` in create_url_tree.ts.
(cherry picked from commit cbbb1d8)1 parent 2b3277f commit c238bd2Copy full SHA for c238bd2
4 files changed
+24-5Lines changed: 24 additions & 5 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/router
- src
- test
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/router/src/apply_redirects.ts
Copy file name to clipboardExpand all lines: packages/router/src/apply_redirects.ts+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
142 | 142 | |
143 | 143 | |
144 | 144 | |
145 | | - |
| 145 | + |
| 146 | + |
146 | 147 | |
147 | 148 | |
148 | 149 | |
|
Collapse file
packages/router/src/create_url_tree.ts
Copy file name to clipboardExpand all lines: packages/router/src/create_url_tree.ts+4-2Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | | - |
| 228 | + |
| 229 | + |
229 | 230 | |
230 | 231 | |
231 | 232 | |
| ||
419 | 420 | |
420 | 421 | |
421 | 422 | |
422 | | - |
| 423 | + |
| 424 | + |
423 | 425 | |
424 | 426 | |
425 | 427 | |
|
Collapse file
packages/router/src/url_tree.ts
Copy file name to clipboardExpand all lines: packages/router/src/url_tree.ts+7-2Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
761 | 761 | |
762 | 762 | |
763 | 763 | |
764 | | - |
| 764 | + |
| 765 | + |
| 766 | + |
| 767 | + |
| 768 | + |
765 | 769 | |
766 | 770 | |
767 | 771 | |
| ||
838 | 842 | |
839 | 843 | |
840 | 844 | |
841 | | - |
| 845 | + |
| 846 | + |
842 | 847 | |
843 | 848 | |
844 | 849 | |
|
Collapse file
packages/router/test/url_serializer.spec.ts
Copy file name to clipboardExpand all lines: packages/router/test/url_serializer.spec.ts+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
132 | 132 | |
133 | 133 | |
134 | 134 | |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
135 | 146 | |
136 | 147 | |
137 | 148 | |
|
0 commit comments