From 2963c0b3fbb66c07e0b2fa392f7caf7b0d028aa5 Mon Sep 17 00:00:00 2001 From: Simon Caminada Date: Mon, 17 Jun 2024 14:40:34 +0200 Subject: [PATCH] fix: update zip archiving --- src/project/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/project/views.py b/src/project/views.py index 7acdaf9..94728b5 100644 --- a/src/project/views.py +++ b/src/project/views.py @@ -114,9 +114,12 @@ class ArchiveFilerPublic(View): with zipfile.ZipFile('filer_public.zip', 'w', zipfile.ZIP_DEFLATED) as zipf: for root, dirs, files in os.walk(path): for file in files: + filePath = os.path.join(root, file) try: - zipf.write(os.path.join(root, file), os.path.relpath(os.path.join(root, file), os.path.join(path, '..'))) - except: - print(file) + with open(filePath) as tempFile: + pass + zipf.write(filePath, os.path.relpath(filePath, os.path.join(path, '..'))) + except IOError: + print(filePath) return HttpResponse('success')