Skip to content

Commit e49abf2

Browse files
committed
fix: check path existence before reading its content
1 parent cf01e53 commit e49abf2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/utils/resolveModelFile.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ export async function resolveModelFile(
279279
async function findMatchingFilesInDirectory(dirPath: string, fileNames: (string | `${string}${typeof genericFilePartNumber}${string}`)[]) {
280280
let directoryFileNames: string[] | undefined = undefined;
281281

282+
if (!(await fs.pathExists(dirPath)) || !(await fs.stat(dirPath)).isDirectory())
283+
return undefined;
284+
282285
for (const expectedFileName of fileNames) {
283286
if (expectedFileName.includes(genericFilePartNumber)) {
284287
const [firstPart, ...restParts] = expectedFileName.split(genericFilePartNumber);

0 commit comments

Comments
 (0)