From aa03dfa4530134d83b70a0baff9e6c195158af65 Mon Sep 17 00:00:00 2001 From: KevinHuSh Date: Mon, 13 May 2024 14:02:38 +0800 Subject: [PATCH] fix bug of get file (#746) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/document_app.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/apps/document_app.py b/api/apps/document_app.py index 6947ac0348..0426402df0 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -349,12 +349,8 @@ def get(doc_id): if not e: return get_data_error_result(retmsg="Document not found!") - informs = File2DocumentService.get_by_document_id(doc_id) - if not informs: - response = flask.make_response(MINIO.get(doc.kb_id, doc.location)) - else: - e, file = FileService.get_by_id(informs[0].file_id) - response = flask.make_response(MINIO.get(file.parent_id, doc.location)) + b,n = File2DocumentService.get_minio_address(doc_id=doc_id) + response = flask.make_response(MINIO.get(b, n)) ext = re.search(r"\.([^.]+)$", doc.name) if ext: