| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c048865 commit 30f26ba
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1401,9 +1401,12 @@ function readdirSyncRecursive(basePath, options) { | |||
| 1401 | 1401 | // of the first array within the result. | |
| 1402 | 1402 | const length = readdirResult[0].length; | |
| 1403 | 1403 | for (let i = 0; i < length; i++) { | |
| 1404 | + // Avoid excluding symlinks, as they are not directories. | ||
| 1405 | + // Refs: https://github.com/nodejs/node/issues/52663 | ||
| 1406 | + const stat = binding.internalModuleStat(binding, pathModule.join(path, readdirResult[0][i])); | ||
| 1404 | 1407 | const dirent = getDirent(path, readdirResult[0][i], readdirResult[1][i]); | |
| 1405 | 1408 | ArrayPrototypePush(readdirResults, dirent); | |
| 1406 | - if (dirent.isDirectory()) { | ||
| 1409 | + if (dirent.isDirectory() || stat === 1) { | ||
| 1407 | 1410 | ArrayPrototypePush(pathsQueue, pathModule.join(dirent.parentPath, dirent.name)); | |
| 1408 | 1411 | } | |
| 1409 | 1412 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,36 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // Refs: https://github.com/nodejs/node/issues/52663 | ||
| 4 | + const common = require('../common'); | ||
| 5 | + const assert = require('node:assert'); | ||
| 6 | + const fs = require('node:fs'); | ||
| 7 | + const path = require('node:path'); | ||
| 8 | + | ||
| 9 | + if (!common.canCreateSymLink()) | ||
| 10 | + common.skip('insufficient privileges'); | ||
| 11 | + | ||
| 12 | + const tmpdir = require('../common/tmpdir'); | ||
| 13 | + const readdirDir = tmpdir.path; | ||
| 14 | + // clean up the tmpdir | ||
| 15 | + tmpdir.refresh(); | ||
| 16 | + | ||
| 17 | + // a/1, a/2 | ||
| 18 | + const a = path.join(readdirDir, 'a'); | ||
| 19 | + fs.mkdirSync(a); | ||
| 20 | + fs.writeFileSync(path.join(a, '1'), 'irrelevant'); | ||
| 21 | + fs.writeFileSync(path.join(a, '2'), 'irrelevant'); | ||
| 22 | + | ||
| 23 | + // b/1 | ||
| 24 | + const b = path.join(readdirDir, 'b'); | ||
| 25 | + fs.mkdirSync(b); | ||
| 26 | + fs.writeFileSync(path.join(b, '1'), 'irrelevant'); | ||
| 27 | + | ||
| 28 | + // b/c -> a | ||
| 29 | + const c = path.join(readdirDir, 'b', 'c'); | ||
| 30 | + fs.symlinkSync(a, c, 'dir'); | ||
| 31 | + | ||
| 32 | + // Just check that the number of entries are the same | ||
| 33 | + assert.strictEqual( | ||
| 34 | + fs.readdirSync(b, { recursive: true, withFileTypes: true }).length, | ||
| 35 | + fs.readdirSync(b, { recursive: true, withFileTypes: false }).length | ||
| 36 | + ); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments