Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: validation for upload methods of non-image files within the work… (#15932)

Arcanere6a8800f66b1
diff --git a/api/factories/file_factory.py b/api/factories/file_factory.py
index c4f69f6f6bc..8c989e6b583 100644
--- a/api/factories/file_factory.py
+++ b/api/factories/file_factory.py
@@ -289,9 +289,15 @@ def _is_file_valid_with_config(
):
return False
- if input_file_type == FileType.IMAGE and config.image_config:
- if config.image_config.transfer_methods and file_transfer_method not in config.image_config.transfer_methods:
+ if input_file_type == FileType.IMAGE:
+ if (
+ config.image_config
+ and config.image_config.transfer_methods
+ and file_transfer_method not in config.image_config.transfer_methods
+ ):
return False
+ elif config.allowed_file_upload_methods and file_transfer_method not in config.allowed_file_upload_methods:
+ return False
return True