Commit a9c18a6
Nedunchezhiyan-M
Fix crash in URL constructor when URL has hash but no protocol
The URL constructor crashes when parsing a URL that contains a hash
but no "://" separator (e.g. "mailto:user@example.com#section").
The split on "://" returns undefined for index [1], and calling
.includes('/') on undefined throws a TypeError.
Added a null check before accessing the split result.1 parent 8bac1df commit a9c18a6
File tree
2 files changed
+6
-1
lines changed- packages/react-native/Libraries/Blob
- __tests__
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
0 commit comments