From c6793a65078769dc71de99304571f299239f5932 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 24 Jan 2024 16:17:29 +0100 Subject: [PATCH] chore(node): Ensure that `package.json` is a file To be on the safe side, ensure that the thing named "package.json" is a file (and not e.g. a directory). Signed-off-by: Sebastian Schuberth --- plugins/package-managers/node/src/main/kotlin/Npm.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/package-managers/node/src/main/kotlin/Npm.kt b/plugins/package-managers/node/src/main/kotlin/Npm.kt index 4a4f890958ad9..6c6aedce9ace1 100644 --- a/plugins/package-managers/node/src/main/kotlin/Npm.kt +++ b/plugins/package-managers/node/src/main/kotlin/Npm.kt @@ -247,7 +247,8 @@ open class Npm( logger.info { "Searching for 'package.json' files in '$nodeModulesDir'..." } val nodeModulesFiles = nodeModulesDir.walk().maxDepth(modulesSearchDepth).filter { - it.name == "package.json" && isValidNodeModulesDirectory(nodeModulesDir, nodeModulesDirForPackageJson(it)) + it.isFile && it.name == "package.json" && + isValidNodeModulesDirectory(nodeModulesDir, nodeModulesDirForPackageJson(it)) } return runBlocking(Dispatchers.IO) {