Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Add validation for dialog name (#8722)

Liu Anaddda5ccbeae
diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py
index 2c4bd725c4..42f496c728 100644
--- a/api/apps/dialog_app.py
+++ b/api/apps/dialog_app.py
@@ -34,6 +34,12 @@ def set_dialog():
req = request.json
dialog_id = req.get("dialog_id")
name = req.get("name", "New Dialog")
+ if not isinstance(name, str):
+ return get_data_error_result(message="Dialog name must be string.")
+ if name.strip() == "":
+ return get_data_error_result(message="Dialog name can't be empty.")
+ if len(name.encode("utf-8")) > 255:
+ return get_data_error_result(message=f"Dialog name length is {len(name)} which is larger than 255")
description = req.get("description", "A helpful dialog")
icon = req.get("icon", "")
top_n = req.get("top_n", 6)