Skip to content

[Bug]: HTTP API Allows Document Name Updates to Exceed 128-Character Length Limit #6060

Closed
@asiroliu

Description

@asiroliu

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

RAGFlow workspace code commit ID

x

RAGFlow image version

9a43ca28ab4d(infiniflow/ragflow:nightly)

Other environment information

Actual behavior

When sending an invalid document name with a length exceeding 128 characters via the PUT endpoint /api/v1/datasets/{dataset_id}/documents/{document_id}, the API incorrectly accepts the request and returns a success response.

Expected behavior

The API should reject the request with an appropriate error code and a message indicating that the document name exceeds the maximum allowed length of 128 characters.

Steps to reproduce

1. Send a PUT request with a document name of 129 characters (e.g., "a" * 125 + ".txt"):

response = requests.put(  
    f'http://127.0.0.1:9380/api/v1/datasets/{dataset_id}/documents/{document_id}',  
    json={"name": f"{'a' * 125}.txt"}  # Total length: 129 characters  
)  

2. Observe the response:

{  
    "code": 0,  
    "data": [  
        {  
            "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt",  // 129 characters  
            // ...other fields  
        }  
    ]  
}

Additional information

https://ragflow.io/docs/dev/http_api_reference#update-document

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions