From 142dfefb7039323469997855a388e14c283c2afe Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 28 Jan 2024 22:12:29 +0000 Subject: [PATCH] Use consistent filename for JPEG files Fixes #505 --- app/logic/uploads.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/logic/uploads.py b/app/logic/uploads.py index 11975638..464f60d0 100644 --- a/app/logic/uploads.py +++ b/app/logic/uploads.py @@ -43,7 +43,7 @@ def upload_file(file, file_type, file_type_desc): is_image = False if file_type == "image": - allowed_extensions = ["jpg", "jpeg", "png", "webp"] + allowed_extensions = ["jpg", "png", "webp"] is_image = True elif file_type == "zip": allowed_extensions = ["zip"] @@ -51,6 +51,9 @@ def upload_file(file, file_type, file_type_desc): raise Exception("Invalid fileType") ext = get_extension(file.filename) + if ext == "jpeg": + ext = "jpg" + if ext is None or ext not in allowed_extensions: raise LogicError(400, lazy_gettext("Please upload %(file_desc)s", file_desc=file_type_desc))