From c1f23c578881b85ae79b524a60160d8f4fb7151b Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sat, 8 Jun 2024 18:36:13 +0200 Subject: fix(ext/node): lossy UTF-8 read node_modules files (#24140) Previously various reads of files in `node_modules` would error on invalid UTF-8. These were cases involving: - reading package.json from Rust - reading package.json from JS - reading CommonJS files from JS - reading CommonJS files from Rust (for ESM translation) - reading ESM files from Rust --- ext/node/ops/require.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/node/ops/require.rs') diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs index de2687001..3e1f1c6ae 100644 --- a/ext/node/ops/require.rs +++ b/ext/node/ops/require.rs @@ -451,7 +451,7 @@ where let file_path = PathBuf::from(file_path); ensure_read_permission::

(state, &file_path)?; let fs = state.borrow::(); - Ok(fs.read_text_file_sync(&file_path, None)?) + Ok(fs.read_text_file_lossy_sync(&file_path, None)?) } #[op2] -- cgit v1.2.3