From 48353a25ca683df26b00ac1f29d67ef7737baf00 Mon Sep 17 00:00:00 2001 From: daz Date: Thu, 12 Sep 2024 20:43:38 -0600 Subject: [PATCH] Do not fail wrapper-validation on filename with illegal characters --- sources/src/wrapper-validation/find.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sources/src/wrapper-validation/find.ts b/sources/src/wrapper-validation/find.ts index de1a89e..7f638ca 100644 --- a/sources/src/wrapper-validation/find.ts +++ b/sources/src/wrapper-validation/find.ts @@ -18,9 +18,14 @@ async function recursivelyListFiles(baseDir: string): Promise { const childrenPaths = await Promise.all( childrenNames.map(async childName => { const childPath = path.resolve(baseDir, childName) - return fs.lstatSync(childPath).isDirectory() - ? recursivelyListFiles(childPath) - : new Promise(resolve => resolve([childPath])) + const stat = fs.lstatSync(childPath, {throwIfNoEntry: false}) + if (stat === undefined) { + return [] + } else if (stat.isDirectory()) { + return recursivelyListFiles(childPath) + } else { + return new Promise(resolve => resolve([childPath])) + } }) ) return Array.prototype.concat(...childrenPaths)