From a9ce931e9f7e2ff5dbf5d3ea778d9f952f21ef1f Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sat, 8 Jul 2023 22:38:55 -0400 Subject: [PATCH] fixup! fs: add a fast-path for readFileSync utf-8 Backport-PR-URL: https://github.com/nodejs/node/pull/48658 --- lib/fs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fs.js b/lib/fs.js index 1090444f294246..de0289b9bd02b8 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -473,7 +473,8 @@ function readFileSync(path, options) { // TODO(@anonrig): Do not handle file descriptor ownership for now. if (!isUserFd && (options.encoding === 'utf8' || options.encoding === 'utf-8')) { - return readFileSyncUtf8(getValidatedPath(path), stringToFlags(options.flag)); + path = getValidatedPath(path); + return readFileSyncUtf8(pathModule.toNamespacedPath(path), stringToFlags(options.flag)); } const fd = isUserFd ? path : fs.openSync(path, options.flag, 0o666);