From: Karl O. Pinc Date: Mon, 18 Jan 2021 01:11:14 +0000 (-0600) Subject: Validate zip file only when there is a uploaded file X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=0a9dce8d9ff2b9e4404bb79df5dc685608ad777d;p=pgwui_bulk_upload Validate zip file only when there is a uploaded file --- 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'])]