From 04f1e18342b04376f967df8aa705aa43fe9f1418 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Sun, 24 Nov 2024 21:10:01 +0800 Subject: [PATCH] fix: Validate file only when file type is set to custom (#11036) Signed-off-by: -LAN- --- api/factories/file_factory.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/factories/file_factory.py b/api/factories/file_factory.py index a5369a38d3..1c368a22ca 100644 --- a/api/factories/file_factory.py +++ b/api/factories/file_factory.py @@ -241,7 +241,11 @@ def _is_file_valid_with_config( ): return False - if config.allowed_file_extensions and file_extension not in config.allowed_file_extensions: + if ( + input_file_type == FileType.CUSTOM + and config.allowed_file_extensions is not None + and file_extension not in config.allowed_file_extensions + ): return False if config.allowed_file_upload_methods and file_transfer_method not in config.allowed_file_upload_methods: