From 80c3416ca71a45c6bb28bd59717248aecd662636 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 9 Jul 2024 00:13:41 +0100 Subject: [PATCH] Fix issue with check all zip files --- app/tasks/importtasks.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py index 09b7e281..b00ebdbd 100644 --- a/app/tasks/importtasks.py +++ b/app/tasks/importtasks.py @@ -342,16 +342,15 @@ def check_zip_release(self, id, path): def check_all_zip_files(): result = [] - with get_temp_dir() as temp: - releases = PackageRelease.query.all() - for release in releases: - with ZipFile(release.file_path, 'r') as zf: - if not _check_zip_file(temp, zf): - print(f"Unsafe zip file for {release.package.get_id} at {release.file_path}", file=sys.stderr) - result.append({ - "package": release.package.get_id(), - "file": release.file_path, - }) + releases = PackageRelease.query.all() + for release in releases: + with ZipFile(release.file_path, 'r') as zf: + if not _check_zip_file("/tmp/example", zf): + print(f"Unsafe zip file for {release.package.get_id()} at {release.file_path}", file=sys.stderr) + result.append({ + "package": release.package.get_id(), + "file": release.file_path, + }) return json.dumps(result)