aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/func
diff options
context:
space:
mode:
authorRuin0x112021-05-09 01:29:36 -0700
committerRuin0x112021-05-09 01:29:36 -0700
commita2b68925ac3c1a7aa2d2e806abbdd8d48f4224f6 (patch)
tree36ddf7b30ca19721283db86fd7bc9cac354283a8 /server/szurubooru/func
parentca771495979b035ac670b850b10239b6e4f10dcc (diff)
Support BMP format uploads
Diffstat (limited to 'server/szurubooru/func')
-rw-r--r--server/szurubooru/func/mime.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/szurubooru/func/mime.py b/server/szurubooru/func/mime.py
index bd553fc..e521c25 100644
--- a/server/szurubooru/func/mime.py
+++ b/server/szurubooru/func/mime.py
@@ -21,6 +21,9 @@ def get_mime_type(content: bytes) -> str:
if content[8:12] == b"WEBP":
return "image/webp"
+ if content[0:2] == b"BM":
+ return "image/bmp"
+
if content[0:4] == b"\x1A\x45\xDF\xA3":
return "video/webm"
@@ -37,6 +40,7 @@ def get_extension(mime_type: str) -> Optional[str]:
"image/jpeg": "jpg",
"image/png": "png",
"image/webp": "webp",
+ "image/bmp": "bmp",
"video/mp4": "mp4",
"video/webm": "webm",
"application/octet-stream": "dat",
@@ -58,6 +62,7 @@ def is_image(mime_type: str) -> bool:
"image/png",
"image/gif",
"image/webp",
+ "image/bmp",
)

© 2015 - 2026 Jakob L. Kreuze