Commit 64acfe6
committed
fix(withoutBase): collapse leading slashes
Slicing the base prefix from inputs like `/api//evil.com` left the
remainder as `//evil.com`, which browsers interpret as a protocol-relative
URL and could enable open redirects when the result flows into a
`Location` header (via `withBase` → `event.url.pathname`).
Normalize all leading slashes on the trimmed remainder so the output is
always a single-host-relative path.
Ref: unjs/ufo#3351 parent d77b673 commit 64acfe6
2 files changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
| |||
0 commit comments