From 165502d2fb0fbc88b70c7303225584ce042b9911 Mon Sep 17 00:00:00 2001 From: William Orr Date: Tue, 17 May 2016 21:51:58 -0700 Subject: [PATCH] `zipfile.ZipFile` can sometimes throw `RuntimeError` --- fido/package.py | 2 +- tests/fixtures/worse.zip | Bin 0 -> 93 bytes tests/test_package.py | 6 ++++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/worse.zip diff --git a/fido/package.py b/fido/package.py index ed17f97e..79266be6 100644 --- a/fido/package.py +++ b/fido/package.py @@ -77,7 +77,7 @@ def detect_formats(self): """Detect available formats inside the ZIP container.""" try: zip_ = zipfile.ZipFile(self.zip) - except zipfile.BadZipfile: + except (zipfile.BadZipfile, RuntimeError): return [] results = [] diff --git a/tests/fixtures/worse.zip b/tests/fixtures/worse.zip new file mode 100644 index 0000000000000000000000000000000000000000..7c3878c877da38ab26e9c9389085f1d4275bce11 GIT binary patch literal 93 zcmWIWW@ZWSW@Hj)7GYpw;9zL@|Np