Explicitly detect mime type

main
Bob Mottram 2021-12-17 10:15:05 +00:00
parent ddd29d8577
commit d5e9652b16
2 changed files with 2 additions and 2 deletions

View File

@ -153,7 +153,7 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
timeoutSec = 10
imageData, mimeType = \
downloadImageAnyMimeType(session, favUrl, timeoutSec, debug)
if not imageData:
if not imageData or not mimeType:
return False
if 'image/png' in mimeType:
favUrl = favUrl.replace('.ico', '.png')

View File

@ -458,7 +458,7 @@ def downloadImage(session, baseDir: str, url: str,
def downloadImageAnyMimeType(session, url: str, timeoutSec: int, debug: bool):
"""http GET for an image with any mime type
"""
mimeType = 'image/png'
mimeType = None
contentType = None
result = None
try: