diff --git a/lib/fs.js b/lib/fs.js index 9ecd1aba397515..ac0049d2576ba0 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1453,8 +1453,8 @@ const splitRootRe = isWindows ? /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/][^\\/]+)?[\\/]*/ : /^[/]*/; -function encodeRealpathResult(result, options, err) { - if (!options || !options.encoding || options.encoding === 'utf8' || err) +function encodeRealpathResult(result, options) { + if (!options || !options.encoding || options.encoding === 'utf8') return result; const asBuffer = Buffer.from(result); if (options.encoding === 'buffer') {