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(file_factory): validate upload_file_id before querying UploadFile (#11937)

-LAN-8f73670925fc
diff --git a/api/factories/file_factory.py b/api/factories/file_factory.py
index 01d95dcfb3d..13034f5cf56 100644
--- a/api/factories/file_factory.py
+++ b/api/factories/file_factory.py
@@ -116,8 +116,11 @@ def _build_from_local_file(
tenant_id: str,
transfer_method: FileTransferMethod,
) -> File:
+ upload_file_id = mapping.get("upload_file_id")
+ if not upload_file_id:
+ raise ValueError("Invalid upload file id")
stmt = select(UploadFile).where(
- UploadFile.id == mapping.get("upload_file_id"),
+ UploadFile.id == upload_file_id,
UploadFile.tenant_id == tenant_id,
)