From f1f33d6c1b4d1b1a5171b8d0be1efed1a28bde17 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Thu, 22 Jun 2023 16:34:14 +0200 Subject: [PATCH] chg: [pystemon importer] fix gzipped pastes --- bin/importer/PystemonImporter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/importer/PystemonImporter.py b/bin/importer/PystemonImporter.py index 536801ba..d7a260f5 100755 --- a/bin/importer/PystemonImporter.py +++ b/bin/importer/PystemonImporter.py @@ -35,7 +35,7 @@ class PystemonImporter(AbstractImporter): print(item_id) if item_id: print(item_id) - full_item_path = os.path.join(self.dir_pystemon, item_id) # TODO SANITIZE PATH + full_item_path = os.path.join(self.dir_pystemon, item_id) # TODO SANITIZE PATH # Check if pystemon file exists if not os.path.isfile(full_item_path): print(f'Error: {full_item_path}, file not found') @@ -47,7 +47,12 @@ class PystemonImporter(AbstractImporter): if not content: return None - return self.create_message(item_id, content, source='pystemon') + if full_item_path[-3:] == '.gz': + gzipped = True + else: + gzipped = False + + return self.create_message(item_id, content, gzipped=gzipped, source='pystemon') except IOError as e: print(f'Error: {full_item_path}, IOError')