Fix: check the file name length. (#6083)

### What problem does this PR solve?

#6060

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-03-14 15:01:37 +08:00
committed by GitHub
parent f0601afa75
commit 5c8ad6702a
2 changed files with 11 additions and 3 deletions

View File

@ -139,10 +139,9 @@ class TestUploadDocuments:
# filename_length = 129
fp = 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"] == 101
assert (
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):