Jelajahi Sumber

fix: Validate file only when file type is set to custom (#11036)

Signed-off-by: -LAN- <laipz8200@outlook.com>
-LAN- 5 bulan lalu
induk
melakukan
04f1e18342
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      api/factories/file_factory.py

+ 5 - 1
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: