GeezerVison is showing github.com — fs: remove redundant `nullCheck` · nodejs/node@ae8bb16
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/fs.js +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -104,7 +104,6 @@ const { | 104 | 104 | getValidatedPath, | 105 | 105 | getValidMode, | 106 | 106 | handleErrorFromBinding, | 107 | | - nullCheck, | 108 | 107 | preprocessSymlinkDestination, | 109 | 108 | Stats, | 110 | 109 | getStatFsFromBinding, | @@ -1398,14 +1397,12 @@ function mkdirSync(path, options) { | 1398 | 1397 | /** | 1399 | 1398 | * An iterative algorithm for reading the entire contents of the `basePath` directory. | 1400 | 1399 | * This function does not validate `basePath` as a directory. It is passed directly to | 1401 | | - * `binding.readdir` after a `nullCheck`. | | 1400 | + * `binding.readdir`. | 1402 | 1401 | * @param {string} basePath | 1403 | 1402 | * @param {{ encoding: string, withFileTypes: boolean }} options | 1404 | 1403 | * @returns {string[] | Dirent[]} | 1405 | 1404 | */ | 1406 | 1405 | function readdirSyncRecursive(basePath, options) { | 1407 | | - nullCheck(basePath, 'path', true); | 1408 | | - | 1409 | 1406 | const withFileTypes = Boolean(options.withFileTypes); | 1410 | 1407 | const encoding = options.encoding; | 1411 | 1408 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-null-bytes.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,6 +66,7 @@ check(fs.mkdir, fs.mkdirSync, 'foo\u0000bar', '0755'); | 66 | 66 | check(fs.open, fs.openSync, 'foo\u0000bar', 'r'); | 67 | 67 | check(fs.readFile, fs.readFileSync, 'foo\u0000bar'); | 68 | 68 | check(fs.readdir, fs.readdirSync, 'foo\u0000bar'); | | 69 | +check(fs.readdir, fs.readdirSync, 'foo\u0000bar', { recursive: true }); | 69 | 70 | check(fs.readlink, fs.readlinkSync, 'foo\u0000bar'); | 70 | 71 | check(fs.realpath, fs.realpathSync, 'foo\u0000bar'); | 71 | 72 | check(fs.rename, fs.renameSync, 'foo\u0000bar', 'foobar'); | @@ -100,6 +101,7 @@ check(fs.mkdir, fs.mkdirSync, fileUrl, '0755'); | 100 | 101 | check(fs.open, fs.openSync, fileUrl, 'r'); | 101 | 102 | check(fs.readFile, fs.readFileSync, fileUrl); | 102 | 103 | check(fs.readdir, fs.readdirSync, fileUrl); | | 104 | +check(fs.readdir, fs.readdirSync, fileUrl, { recursive: true }); | 103 | 105 | check(fs.readlink, fs.readlinkSync, fileUrl); | 104 | 106 | check(fs.realpath, fs.realpathSync, fileUrl); | 105 | 107 | check(fs.rename, fs.renameSync, fileUrl, 'foobar'); | @@ -131,6 +133,7 @@ check(fs.mkdir, fs.mkdirSync, fileUrl2, '0755'); | 131 | 133 | check(fs.open, fs.openSync, fileUrl2, 'r'); | 132 | 134 | check(fs.readFile, fs.readFileSync, fileUrl2); | 133 | 135 | check(fs.readdir, fs.readdirSync, fileUrl2); | | 136 | +check(fs.readdir, fs.readdirSync, fileUrl2, { recursive: true }); | 134 | 137 | check(fs.readlink, fs.readlinkSync, fileUrl2); | 135 | 138 | check(fs.realpath, fs.realpathSync, fileUrl2); | 136 | 139 | check(fs.rename, fs.renameSync, fileUrl2, 'foobar'); | |
|