From 193615a441236583c3b8999601544ebb3ae82d40 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 18 Jun 2022 23:11:53 +0200 Subject: [PATCH] make sure thumbnails are always lower than 8 MB --- files/helpers/media.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index feea19da8..a91c7d758 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -72,7 +72,10 @@ def process_video(file): def process_image(filename=None, resize=0): size = os.stat(filename).st_size - if size > 16 * 1024 * 1024 or not g.v.patron and size > 8 * 1024 * 1024: + if resize == 100: patron = False + else: patron = g.v.patron + + if size > 16 * 1024 * 1024 or not patron and size > 8 * 1024 * 1024: os.remove(filename) abort(413)