From 2e5021e4ef736f6d55f21115add4aef2a8c2cda1 Mon Sep 17 00:00:00 2001 From: Jack Darlington Date: Thu, 23 Feb 2017 22:03:23 +0000 Subject: [PATCH] Fixed issue with some epubs not getting correct metadata when uploading --- cps/epub.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cps/epub.py b/cps/epub.py index e6945d75..ddd731df 100644 --- a/cps/epub.py +++ b/cps/epub.py @@ -11,7 +11,10 @@ def extractCover(zip, coverFile, tmp_file_name): if coverFile is None: return None else: - cf = zip.read("OPS/" + coverFile) + try: + cf = zip.read("OPS/" + coverFile) + except KeyError, e: + cf = zip.read(coverFile) prefix = os.path.splitext(tmp_file_name)[0] tmp_cover_name = prefix + "." + coverFile image = open(tmp_cover_name, 'wb')