Edit book: Download external resources: Fix incorrect filename if the server returns a generic Content-Type header

Fix #2099754 [Private bug](https://bugs.launchpad.net/calibre/+bug/2099754)
This commit is contained in:
Kovid Goyal 2025-02-23 18:34:28 +05:30
parent 85e930555c
commit 249c2d11a1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -62,7 +62,7 @@ def get_filename(original_url_parsed, response):
ct = headers.get_params()[0][0].lower() ct = headers.get_params()[0][0].lower()
except Exception: except Exception:
ct = '' ct = ''
if ct: if ct and ct != 'application/octet-stream':
mt = guess_type(ans) mt = guess_type(ans)
if mt != ct: if mt != ct:
exts = mimetypes.guess_all_extensions(ct) exts = mimetypes.guess_all_extensions(ct)