Skip to content

Commit 4515a28

Browse files
LiviaMedeirosRafaelGSS
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 24c3742 commit 4515a28

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎lib/fs.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,14 +1420,12 @@ function mkdirSync(path, options){
14201420
/**
14211421
* An iterative algorithm for reading the entire contents of the `basePath` directory.
14221422
* This function does not validate `basePath` as a directory. It is passed directly to
1423-
* `binding.readdir` after a `nullCheck`.
1423+
* `binding.readdir`.
14241424
* @param{string} basePath
14251425
* @param{{encoding: string, withFileTypes: boolean }} options
14261426
* @returns{string[] | Dirent[]}
14271427
*/
14281428
functionreaddirSyncRecursive(basePath,options){
1429-
nullCheck(basePath,'path',true);
1430-
14311429
constwithFileTypes=Boolean(options.withFileTypes);
14321430
constencoding=options.encoding;
14331431

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

Lines changed: 3 additions & 0 deletions
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)