Skip to content

Commit

Permalink
fix bug of get file (infiniflow#746)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored May 13, 2024
1 parent 69b7c61 commit aa03dfa
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions api/apps/document_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit aa03dfa

Please sign in to comment.