From 49a028a5992320c6385a55048185900b76c3597d Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Tue, 8 Sep 2020 19:04:04 +0200 Subject: [PATCH] Bugfix not unlink generic cover on upload --- cps/editbooks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cps/editbooks.py b/cps/editbooks.py index 84a24ca5..ded4ec15 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -862,7 +862,8 @@ def upload(): new_coverpath = os.path.join(config.config_calibre_dir, db_book.path, "cover.jpg") try: copyfile(coverfile, new_coverpath) - os.unlink(meta.cover) + if meta.cover: + os.unlink(meta.cover) except OSError as e: log.error("Failed to move cover file %s: %s", new_coverpath, e) flash(_(u"Failed to Move Cover File %(file)s: %(error)s", file=new_coverpath,