Skip to content

Commit

Permalink
add logs and fix encode
Browse files Browse the repository at this point in the history
Signed-off-by: ziad <ziadhany2016@gmail.com>
  • Loading branch information
ziadhany committed Sep 6, 2022
1 parent 0d22189 commit 63416e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vulnerabilities/importers/gsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class GSDImporter(Importer):
def advisory_data(self) -> Iterable[AdvisoryData]:
forked_dir = fork_and_get_dir(self.gsd_url)
for file in get_files(forked_dir):
yield parse_advisory_data(file)
try:
yield parse_advisory_data(file)
except Exception as e:
logger.error(f"{e !r}")


def parse_advisory_data(file):
Expand All @@ -47,7 +50,7 @@ def parse_advisory_data(file):

GSD = raw_data.get("GSD") or {}
GSD_alias = [].append(GSD.get("alias")) or []
details = GSD.get("description") or get_description(cve_org)
details = GSD.get("description") or "".join(get_description(cve_org))
GSD_id = [].append(GSD.get("id")) or []

aliases_cve_org = get_aliases(cve_org)
Expand Down Expand Up @@ -188,5 +191,5 @@ def get_files(fork_directory):
continue
for root, _, files in os.walk(os.path.join(fork_directory, root_dir)):
for file in files:
with open(os.path.join(root, file), "r") as f:
with open(os.path.join(root, file), "r", encoding="ISO-8859-1") as f:
yield f.read()

0 comments on commit 63416e7

Please sign in to comment.