Skip to content

Commit ae8bb16

Browse files
LiviaMedeirostargos
authored andcommitted
fs: remove redundant nullCheck
PR-URL: #48826 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent 97d8749 commit ae8bb16

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/fs.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ const {
104104
getValidatedPath,
105105
getValidMode,
106106
handleErrorFromBinding,
107-
nullCheck,
108107
preprocessSymlinkDestination,
109108
Stats,
110109
getStatFsFromBinding,
@@ -1398,14 +1397,12 @@ function mkdirSync(path, options) {
13981397
/**
13991398
* An iterative algorithm for reading the entire contents of the `basePath` directory.
14001399
* This function does not validate `basePath` as a directory. It is passed directly to
1401-
* `binding.readdir` after a `nullCheck`.
1400+
* `binding.readdir`.
14021401
* @param {string} basePath
14031402
* @param {{ encoding: string, withFileTypes: boolean }} options
14041403
* @returns {string[] | Dirent[]}
14051404
*/
14061405
function readdirSyncRecursive(basePath, options) {
1407-
nullCheck(basePath, 'path', true);
1408-
14091406
const withFileTypes = Boolean(options.withFileTypes);
14101407
const encoding = options.encoding;
14111408

test/parallel/test-fs-null-bytes.js

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ check(fs.mkdir, fs.mkdirSync, 'foo\u0000bar', '0755');
6666
check(fs.open, fs.openSync, 'foo\u0000bar', 'r');
6767
check(fs.readFile, fs.readFileSync, 'foo\u0000bar');
6868
check(fs.readdir, fs.readdirSync, 'foo\u0000bar');
69+
check(fs.readdir, fs.readdirSync, 'foo\u0000bar', { recursive: true });
6970
check(fs.readlink, fs.readlinkSync, 'foo\u0000bar');
7071
check(fs.realpath, fs.realpathSync, 'foo\u0000bar');
7172
check(fs.rename, fs.renameSync, 'foo\u0000bar', 'foobar');
@@ -100,6 +101,7 @@ check(fs.mkdir, fs.mkdirSync, fileUrl, '0755');
100101
check(fs.open, fs.openSync, fileUrl, 'r');
101102
check(fs.readFile, fs.readFileSync, fileUrl);
102103
check(fs.readdir, fs.readdirSync, fileUrl);
104+
check(fs.readdir, fs.readdirSync, fileUrl, { recursive: true });
103105
check(fs.readlink, fs.readlinkSync, fileUrl);
104106
check(fs.realpath, fs.realpathSync, fileUrl);
105107
check(fs.rename, fs.renameSync, fileUrl, 'foobar');
@@ -131,6 +133,7 @@ check(fs.mkdir, fs.mkdirSync, fileUrl2, '0755');
131133
check(fs.open, fs.openSync, fileUrl2, 'r');
132134
check(fs.readFile, fs.readFileSync, fileUrl2);
133135
check(fs.readdir, fs.readdirSync, fileUrl2);
136+
check(fs.readdir, fs.readdirSync, fileUrl2, { recursive: true });
134137
check(fs.readlink, fs.readlinkSync, fileUrl2);
135138
check(fs.realpath, fs.realpathSync, fileUrl2);
136139
check(fs.rename, fs.renameSync, fileUrl2, 'foobar');

0 commit comments

Comments
 (0)