From dba175da393faf02d9c8242647bd4afdbbea088c Mon Sep 17 00:00:00 2001 From: kannibalox Date: Tue, 21 Feb 2023 00:44:27 -0500 Subject: [PATCH] Fix handling a cover without content-type --- src/ptpapi/scripts/ptp_origin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ptpapi/scripts/ptp_origin.py b/src/ptpapi/scripts/ptp_origin.py index 9ee84dc..99154c4 100644 --- a/src/ptpapi/scripts/ptp_origin.py +++ b/src/ptpapi/scripts/ptp_origin.py @@ -155,7 +155,9 @@ def write_origin(t, args): ) as exc: logger.error("Could not fetch cover URL %s: %s", m.group(0), exc) return - if "Content-Type" in resp.headers and resp.headers[ + if "Content-Type" not in resp.headers: + logger.warning("Cover did not return an content-type, cannot save") +a if resp.headers[ "Content-Type" ].startswith("image"): with path.open("wb") as fh: