diff options
| author | rr- | 2016-09-29 12:58:53 +0200 |
|---|---|---|
| committer | rr- | 2016-09-29 12:59:40 +0200 |
| commit | 049a0dc351db6a16c20cc23e8d63303e49b38bad (patch) | |
| tree | 0a472b8d5a6ea5ecd41816942f1a78d51a1e282f /server | |
| parent | f44f2335dae61bf42b2009305e6f31bfeaf39009 (diff) | |
server/mime: fix GIF animation heuristics
Closes #100
Diffstat (limited to 'server')
| -rw-r--r-- | server/szurubooru/func/mime.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/szurubooru/func/mime.py b/server/szurubooru/func/mime.py index 0f712d1..2277ed6 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 |