fix(ext/node): don't throw error on invalid path input on exists and existsSync (#29971)

Currently `fs.exists` and `fs.existsSync` throws error when invalid path
is given to the input.

The expected behavior is to:
- Call the callback with false on `fs.exists`.
- Return false on `fs.existsSync`.

Towards #29972, #24236
This commit is contained in:
Daniel Osvaldo R 2025-07-08 17:30:45 +07:00 committed by GitHub
parent c03199ea1e
commit 1c16fde60f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 21 deletions

View file

@ -46,7 +46,9 @@ export function once(callback) {
// In addition to being accessible through util.promisify.custom,
// this symbol is registered globally and can be accessed in any environment as
// Symbol.for('nodejs.util.promisify.custom').
const kCustomPromisifiedSymbol = SymbolFor("nodejs.util.promisify.custom");
export const kCustomPromisifiedSymbol = SymbolFor(
"nodejs.util.promisify.custom",
);
// This is an internal Node symbol used by functions returning multiple
// arguments, e.g. ['bytesRead', 'buffer'] for fs.read().
const kCustomPromisifyArgsSymbol = SymbolFor(