1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
denoland-deno/ext
Chen Su ae84e01e8a
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705)
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:

```ts
import { Buffer } from "node:buffer";

Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();

// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
//                    ^
//     at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
//     at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
//     at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
//     at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
//     at fromString (ext:deno_node/internal/buffer.mjs:214:22)
//     at _from (ext:deno_node/internal/buffer.mjs:119:12)
//     at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
//     at file:///Users/foodieats/temp/buffer1.ts:3:20
```

The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`

Also fixed #20563 .
2023-10-13 00:39:27 +02:00
..
broadcast_channel 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
cache 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
console 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
crypto 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
fetch 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
ffi 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
fs 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
http 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
io 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
kv 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
napi 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
net 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
node fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705) 2023-10-13 00:39:27 +02:00
tls 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
url 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
web 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
webidl 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
websocket 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
webstorage 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30