Skip to content

Commit

Permalink
fix: correct node_module path (#5127)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong committed Dec 9, 2022
2 parents b3d6146 + 7841d46 commit e20886e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion core/README.md
Expand Up @@ -3,7 +3,6 @@ Dependency-Check-Core

Dependency-Check-Core is the main engine used by all of the other modules to do the analysis and reporting.


Copyright & License
------------

Expand Down
Expand Up @@ -359,16 +359,21 @@ private void processDependencies(JsonObject json, File baseDir, File rootFile,

if (deps != null) {
for (Map.Entry<String, JsonValue> entry : deps.entrySet()) {
String pathName = entry.getKey();
final String pathName = entry.getKey();
String name = pathName;
final File base;
File base;

final int indexOfNodeModule = name.lastIndexOf(NODE_MODULES_DIRNAME);
if (indexOfNodeModule >= 0) {
name = name.substring(indexOfNodeModule + NODE_MODULES_DIRNAME.length() + 1);
base = Paths.get(baseDir.getPath(), pathName).toFile();
} else {
base = Paths.get(baseDir.getPath(), "node_modules", name).toFile();
if (!base.isFile()) {
if ("node_modules".equals(baseDir.getParentFile().getName())) {
base = Paths.get(baseDir.getParent(), name).toFile();
}
}
}

final String version;
Expand Down

0 comments on commit e20886e

Please sign in to comment.