mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[downloader:http] add signature checks for some formats
also add the MIME type for .obj files
This commit is contained in:
parent
512abeb4ae
commit
b6706b373a
@ -392,6 +392,8 @@ MIME_TYPES = {
|
||||
"application/x-shockwave-flash": "swf",
|
||||
|
||||
"application/ogg": "ogg",
|
||||
# https://www.iana.org/assignments/media-types/model/obj
|
||||
"model/obj": "obj",
|
||||
"application/octet-stream": "bin",
|
||||
}
|
||||
|
||||
@ -421,6 +423,13 @@ SIGNATURE_CHECKS = {
|
||||
"7z" : lambda s: s[0:6] == b"\x37\x7A\xBC\xAF\x27\x1C",
|
||||
"pdf" : lambda s: s[0:5] == b"%PDF-",
|
||||
"swf" : lambda s: s[0:3] in (b"CWS", b"FWS"),
|
||||
"blend": lambda s: s[0:7] == b"BLENDER",
|
||||
# unfortunately the Wavefront .obj format doesn't have a signature,
|
||||
# so we check for the existence of Blender's comment
|
||||
"obj" : lambda s: s[0:11] == b"# Blender v",
|
||||
# Celsys Clip Studio Paint format
|
||||
# https://github.com/rasensuihei/cliputils/blob/master/README.md
|
||||
"clip": lambda s: s[0:8] == b"CSFCHUNK",
|
||||
# check 'bin' files against all other file signatures
|
||||
"bin" : lambda s: False,
|
||||
}
|
||||
|
@ -313,6 +313,9 @@ SAMPLES = {
|
||||
("pdf" , b"%PDF-"),
|
||||
("swf" , b"FWS"),
|
||||
("swf" , b"CWS"),
|
||||
("blend", b"BLENDER-v303RENDH"),
|
||||
("obj" , b"# Blender v3.2.0 OBJ File: 'foo.blend'"),
|
||||
("clip", b"CSFCHUNK\x00\x00\x00\x00"),
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user