From 6772ce9c0f1deac0a0f545ab42fa909879f18cbd Mon Sep 17 00:00:00 2001 From: Ellen Wang Date: Tue, 2 Apr 2024 13:50:52 -0400 Subject: [PATCH 1/2] fix: error with writing package info with slashes in name --- guarddog/scanners/scanner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guarddog/scanners/scanner.py b/guarddog/scanners/scanner.py index 9a85427a..1897fac6 100644 --- a/guarddog/scanners/scanner.py +++ b/guarddog/scanners/scanner.py @@ -259,7 +259,9 @@ 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)) From 46e8919c46c1450a9b62f61ea249aff18e9d7866 Mon Sep 17 00:00:00 2001 From: Ellen Wang Date: Tue, 2 Apr 2024 13:56:01 -0400 Subject: [PATCH 2/2] fix: blankspace linting --- guarddog/scanners/scanner.py | 1 - 1 file changed, 1 deletion(-) diff --git a/guarddog/scanners/scanner.py b/guarddog/scanners/scanner.py index 1897fac6..6b2e7094 100644 --- a/guarddog/scanners/scanner.py +++ b/guarddog/scanners/scanner.py @@ -261,7 +261,6 @@ def _scan_remote(self, name, base_dir, version=None, rules=None, write_package_i if write_package_info: 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))