RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: check the file name length. (#6083)
Kevin Hu5c8ad6702ad6
diff --git a/api/apps/sdk/doc.py b/api/apps/sdk/doc.pyindex bd8c60c746..6ecb2fa97c 100644--- a/api/apps/sdk/doc.py+++ b/api/apps/sdk/doc.py@@ -136,6 +136,10 @@ def upload(dataset_id, tenant_id):return get_result(message="No file selected!", code=settings.RetCode.ARGUMENT_ERROR)+ if len(file_obj.filename.encode("utf-8")) >= 128:+ return get_result(+ message="File name should be less than 128 bytes.", code=settings.RetCode.ARGUMENT_ERROR+ )'''# total sizetotal_size = 0@@ -246,6 +250,11 @@ def update_doc(tenant_id, dataset_id, document_id):DocumentService.update_meta_fields(document_id, req["meta_fields"])if "name" in req and req["name"] != doc.name:+ if len(req["name"].encode("utf-8")) >= 128:+ return get_result(+ message="The name should be less than 128 bytes.",+ code=settings.RetCode.ARGUMENT_ERROR,+ )if (pathlib.Path(req["name"].lower()).suffix!= pathlib.Path(doc.name.lower()).suffixdiff --git a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.pyindex 2f55532ae0..b6e7b72710 100644--- a/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py+++ b/sdk/python/test/test_http_api/test_file_management_within_dataset/test_upload_documents.py@@ -139,10 +139,9 @@ class TestUploadDocuments:# filename_length = 129fp = create_txt_file(tmp_path / f"{'a' * (DOCUMENT_NAME_LIMIT - 3)}.txt")res = upload_documnets(get_http_api_auth, ids[0], [fp])- assert res["code"] == 500+ assert res["code"] == 101assert (- res["message"]- == f"{'a' * (DOCUMENT_NAME_LIMIT - 3)}.txt: Exceed the maximum length of file name!"+ res["message"].find("128") >= 0)def test_invalid_dataset_id(self, get_http_api_auth, tmp_path):