From fb573f0d017c7db2c4bfc1090667f89c01596ff4 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 18 Nov 2024 15:45:46 +0200 Subject: [PATCH] for easier effortposting: increase file limit from 20 to 50, and skip broken images --- files/assets/js/core.js | 4 ++-- files/helpers/media.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 381570493..dac49fa35 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -576,9 +576,9 @@ function handle_files(input, newfiles) { } for (let file of newfiles) { - if (oldfiles[ta.id].items.length == 20) + if (oldfiles[ta.id].items.length == 50) { - window.alert("You can't upload more than 20 files at one time!") + window.alert("You can't upload more than 50 files at one time!") break } diff --git a/files/helpers/media.py b/files/helpers/media.py index 722f0723b..f4b9406bb 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -48,7 +48,7 @@ def media_ratelimit(v): def process_files(files, v, body, is_dm=False, dm_user=None, is_badge_thread=False, comment_body=None): if g.is_tor or not files.get("file"): return body - files = files.getlist('file')[:20] + files = files.getlist('file')[:50] if files: media_ratelimit(v) @@ -61,7 +61,10 @@ def process_files(files, v, body, is_dm=False, dm_user=None, is_badge_thread=Fal if file.content_type.startswith('image/'): name = f'/images/{time.time()}'.replace('.','') + '.webp' file.save(name) - url = process_image(name, v) + try: url = process_image(name, v) + except Exception as e: + print(e) + continue if is_badge_thread: process_badge_entry(name, v, comment_body) elif file.content_type.startswith('video/'):