Commit 09fc331
committed
buffer: normalize lone "\r" in Blob native line endings
`new Blob(parts, { endings: 'native' })` failed to normalize a
standalone carriage return. The replacement regex only matched
`\n` and `\r\n`, so a lone `\r` (and runs such as `\r\r`) were
left untouched instead of being converted to the platform's
native line ending.
The WHATWG "convert line endings to native" algorithm requires
`\r`, `\n`, and `\r\n` to all be normalized. Match `\r\n` before
a lone `\r` so that CRLF collapses to a single native ending.
Refs: https://w3c.github.io/FileAPI/#convert-line-endings-to-native
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>1 parent bfb2fa7 commit 09fc331
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
406 | 424 | | |
407 | 425 | | |
408 | 426 | | |
| |||
0 commit comments