From 2edcdee32f5e5e46f30cb5a77ab5403778468aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 15 Apr 2023 17:09:22 +0200 Subject: [PATCH] [downloader:http] add MIME type and signature for .heic files (#3915) https://github.com/strukturag/libheif/issues/83 --- gallery_dl/downloader/http.py | 4 ++++ test/test_downloader.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index e977320f..88e86e9c 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -353,6 +353,8 @@ MIME_TYPES = { "image/x-ms-bmp": "bmp", "image/webp" : "webp", "image/avif" : "avif", + "image/heic" : "heic", + "image/heif" : "heif", "image/svg+xml" : "svg", "image/ico" : "ico", "image/icon" : "ico", @@ -399,6 +401,8 @@ SIGNATURE_CHECKS = { "webp": lambda s: (s[0:4] == b"RIFF" and s[8:12] == b"WEBP"), "avif": lambda s: s[4:11] == b"ftypavi" and s[11] in b"fs", + "heic": lambda s: (s[4:10] == b"ftyphe" and s[10:12] in ( + b"ic", b"im", b"is", b"ix", b"vc", b"vm", b"vs")), "svg" : lambda s: s[0:5] == b"