From 191c9518a4b6a6eb16f466ea5e0cb98b3f23c31c Mon Sep 17 00:00:00 2001 From: XiaoXinYo <1104361313@qq.com> Date: Tue, 15 Aug 2023 17:19:23 +0800 Subject: [PATCH] Add Filename Extension --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index be2cbdf..b3973e5 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,8 @@ def submit() -> Response: return core.GenerateResponse().error(110, 'parameter cannot be empty') targetFormat = target.filename.split('.')[-1] - if targetFormat not in ['png', 'jpg', 'mp4']: + targetFormat = targetFormat.lower() + if targetFormat not in ['png', 'jpeg', 'jpg', 'mp4']: return core.GenerateResponse().error(110, 'the target file format is not supported') elif target.content_length > config.INPUT_FILE_MAX_SIZE * 1024: return core.GenerateResponse().error(110, 'the target file size exceeds the max limit') @@ -44,7 +45,8 @@ def submit() -> Response: if not source: return core.GenerateResponse().error(110, 'parameter cannot be empty') sourceFormat = source.filename.split('.')[-1] - if sourceFormat not in ['png', 'jpg']: + sourceFormat = sourceFormat.lower() + if sourceFormat not in ['png', 'jpeg', 'jpg']: return core.GenerateResponse().error(110, 'the source file format is not supported') elif source.content_length > config.INPUT_FILE_MAX_SIZE * 1024: return core.GenerateResponse().error(110, 'the source file size exceeds the max limit')