1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-07 06:46:59 -05:00
denoland-deno/ext/node
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
..
ops refactor: rewrite ext/node/crypto to op2 macro (#20675) 2023-09-26 12:07:04 +00:00
polyfills fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705) 2023-10-13 00:39:27 +02:00
analyze.rs chore: rename some helpers on the Fs trait (#20097) 2023-08-08 16:28:18 -04:00
build.rs build: allow disabling snapshots for dev (#20048) 2023-08-06 01:47:15 +02:00
Cargo.toml 1.37.1 (#20703) 2023-09-27 11:54:44 +05:30
clippy.toml refactor(ext/fs): deno_fs::FileSystem - conditional Send + Sync (#18993) 2023-05-08 11:02:02 -04:00
errors.rs fix(node): package path not exported error - add if types resolution was occurring (#19963) 2023-07-27 16:27:01 +00:00
global.rs chore: update to Rust 1.72 (#20258) 2023-08-26 22:04:12 -06:00
lib.rs chore: slight cleanup in npm resolvers (#20692) 2023-09-26 16:42:39 -04:00
package_json.rs fix(node/package_json): Avoid panic when "exports" field is null (#20588) 2023-09-22 11:21:38 +02:00
path.rs chore(ext/node): fix variable name (#17948) 2023-02-27 21:26:02 +01:00
polyfill.rs fix(node): repl._builtinLibs (#20046) 2023-08-04 14:30:48 +02:00
README.md chore(ext/node): correct publishing for ext/node (#15461) 2022-08-11 17:25:41 -04:00
resolution.rs chore: slight cleanup in npm resolvers (#20692) 2023-09-26 16:42:39 -04:00

deno_node

require and other node related functionality for Deno.