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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: enhance filename validation and extraction in FileService #16867 (#16869)
GuanMud65da600e5c7
diff --git a/api/services/file_service.py b/api/services/file_service.pyindex d417e81734c..284e96c97ad 100644--- a/api/services/file_service.py+++ b/api/services/file_service.py@@ -1,5 +1,6 @@import datetimeimport hashlib+import osimport uuidfrom typing import Any, Literal, Union@@ -38,7 +39,12 @@ class FileService:source_url: str = "",) -> UploadFile:# get file extension- extension = filename.split(".")[-1].lower()+ extension = os.path.splitext(filename)[1].lstrip(".").lower()++ # check if filename contains invalid characters+ if any(c in filename for c in ["/", "\\", ":", "*", "?", '"', "<", ">", "|"]):+ raise ValueError("Filename contains invalid characters")+if len(filename) > 200:filename = filename.split(".")[0][:200] + "." + extension