From ade05ae2bc4630f7fffc765581c4a021a50ccb48 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 22 Oct 2024 17:16:26 +0300 Subject: [PATCH] exempt localhost from size restrictions --- files/assets/js/core.js | 2 ++ files/helpers/media.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 104a3e3bd..5f7e0a2dd 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -523,6 +523,8 @@ else patron = 'patron' function check_file_size(input, file) { if (!file) return false + if (location.host == 'localhost') return true + let max_size let max_size_patron let type diff --git a/files/helpers/media.py b/files/helpers/media.py index 3b247952f..7c5c824a4 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -171,7 +171,7 @@ def process_video(file, v): file.save(old) size = os.stat(old).st_size - if size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 or (not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024): + if not IS_LOCALHOST and (size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 or (not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024)): os.remove(old) stop(413, f"Max video size is {MAX_VIDEO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for {patron}s)")