From 0a9dce8d9ff2b9e4404bb79df5dc685608ad777d Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Sun, 17 Jan 2021 19:11:14 -0600 Subject: [PATCH] Validate zip file only when there is a uploaded file --- src/pgwui_bulk_upload/views/bulk_upload.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pgwui_bulk_upload/views/bulk_upload.py b/src/pgwui_bulk_upload/views/bulk_upload.py index 03a4e8b..ae13dd1 100644 --- a/src/pgwui_bulk_upload/views/bulk_upload.py +++ b/src/pgwui_bulk_upload/views/bulk_upload.py @@ -515,6 +515,8 @@ class BulkTableUploadHandler(BaseTableUploadHandler): '''Validate the uploaded archive; un-archive it and save a path to the decompressed archive. Return a list of errors. ''' + if self.uf['filename'] == '': + return [] # Don't bother, there is no uploaded file fh = self.uf['localfh'] if not zipfile.is_zipfile(fh): return [ex.NotAZipfileError(self.uf['filename'])] -- 2.34.1