merge-requests/30/head
Bob Mottram 2021-12-17 10:07:49 +00:00
parent 823766088e
commit 2b74116f12
1 changed files with 13 additions and 8 deletions

View File

@ -493,12 +493,17 @@ def downloadImageAnyMimeType(session, url: str, timeoutSec: int, debug: bool):
if not contentType: if not contentType:
return None, None return None, None
if 'image/x-icon' in contentType: imageFormats = {
mimeType = 'image/x-icon' 'ico': 'x-icon',
elif 'image/webp' in contentType: 'png': 'png',
mimeType = 'image/webp' 'jpg': 'jpeg',
elif 'image/jpeg' in contentType: 'jpeg': 'jpeg',
mimeType = 'image/jpeg' 'gif': 'gif',
elif 'image/gif' in contentType: 'svg': 'svg+xml',
mimeType = 'image/gif' 'webp': 'webp',
'avif': 'avif'
}
for imFormat, mType in imageFormats.items():
if 'image/' + mType in contentType:
mimeType = 'image/' + mType
return result.content, mimeType return result.content, mimeType