Skip to content

Commit

Permalink
Merge pull request #315 from DataDog/ellen.wang/fix-npm-write-info
Browse files Browse the repository at this point in the history
[Bugfix] NPM Package Info Writing
  • Loading branch information
enelli authored Apr 2, 2024
2 parents 7a7d445 + 46e8919 commit d2102d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion guarddog/scanners/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def _scan_remote(self, name, base_dir, version=None, rules=None, write_package_i

results = self.analyzer.analyze(file_path, package_info, rules, name, version)
if write_package_info:
suffix = f"{name}-{version}" if version is not None else name
package_name = name.replace("/", "-")
suffix = f"{package_name}-{version}" if version is not None else package_name
with open(os.path.join(results["path"], f'package_info-{suffix}.json'), "w") as file:
file.write(json.dumps(package_info))

Expand Down

0 comments on commit d2102d4

Please sign in to comment.