From 049a0dc351db6a16c20cc23e8d63303e49b38bad Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 29 Sep 2016 12:58:53 +0200 Subject: [PATCH] server/mime: fix GIF animation heuristics Closes #100 --- server/szurubooru/func/mime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/szurubooru/func/mime.py b/server/szurubooru/func/mime.py index 0f712d1a..2277ed64 100644 --- a/server/szurubooru/func/mime.py +++ b/server/szurubooru/func/mime.py @@ -52,5 +52,6 @@ def is_image(mime_type): def is_animated_gif(content): + pattern = b'\x21\xF9\x04[\x00-\xFF]{4}\x00[\x2C\x21]' return get_mime_type(content) == 'image/gif' \ - and len(re.findall(b'\x21\xF9\x04.{4}\x00[\x2C\x21]', content)) > 1 + and len(re.findall(pattern, content)) > 1