1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[downloader:http] add MIME type and signature for .heic files

(#3915)
https://github.com/strukturag/libheif/issues/83
This commit is contained in:
Mike Fährmann 2023-04-15 17:09:22 +02:00
parent c45f09d2a8
commit 2edcdee32f
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 8 additions and 0 deletions

View File

@ -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"<?xml",
"ico" : lambda s: s[0:4] == b"\x00\x00\x01\x00",
"cur" : lambda s: s[0:4] == b"\x00\x00\x02\x00",

View File

@ -289,6 +289,10 @@ SAMPLES = {
("webp", b"RIFF????WEBP"),
("avif", b"????ftypavif"),
("avif", b"????ftypavis"),
("heic", b"????ftypheic"),
("heic", b"????ftypheim"),
("heic", b"????ftypheis"),
("heic", b"????ftypheix"),
("svg" , b"<?xml"),
("ico" , b"\x00\x00\x01\x00"),
("cur" , b"\x00\x00\x02\x00"),