diff options
author | Chen Su <ghosind@gmail.com> | 2023-09-27 21:54:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 07:54:19 -0600 |
commit | 507f24c4746e24ea60dcebdffacd0b66e3d4bfc1 (patch) | |
tree | 710dbba8131625de018c506b8b9927621d1e9702 /cli/tools/task.rs | |
parent | aef56f3d70f3c898d7c99b74ad72cc08a16e5780 (diff) |
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 .
Diffstat (limited to 'cli/tools/task.rs')
0 files changed, 0 insertions, 0 deletions