Fix: empty doc id validation. (#6064)

### What problem does this PR solve?

#6031

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-03-14 11:45:44 +08:00
committed by GitHub
parent c00def5b71
commit 7463241896
2 changed files with 7 additions and 2 deletions

View File

@ -363,6 +363,10 @@ def download(tenant_id, dataset_id, document_id):
schema:
type: object
"""
if not document_id:
return get_error_data_result(
message="Specify document_id please."
)
if not KnowledgebaseService.query(id=dataset_id, tenant_id=tenant_id):
return get_error_data_result(message=f"You do not own the dataset {dataset_id}.")
doc = DocumentService.query(kb_id=dataset_id, id=document_id)