KevinHuSh commited on
Commit
46bd186
·
1 Parent(s): dc5c4e1

fix bug of get file (#746)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. api/apps/document_app.py +2 -6
api/apps/document_app.py CHANGED
@@ -349,12 +349,8 @@ def get(doc_id):
349
  if not e:
350
  return get_data_error_result(retmsg="Document not found!")
351
 
352
- informs = File2DocumentService.get_by_document_id(doc_id)
353
- if not informs:
354
- response = flask.make_response(MINIO.get(doc.kb_id, doc.location))
355
- else:
356
- e, file = FileService.get_by_id(informs[0].file_id)
357
- response = flask.make_response(MINIO.get(file.parent_id, doc.location))
358
 
359
  ext = re.search(r"\.([^.]+)$", doc.name)
360
  if ext:
 
349
  if not e:
350
  return get_data_error_result(retmsg="Document not found!")
351
 
352
+ b,n = File2DocumentService.get_minio_address(doc_id=doc_id)
353
+ response = flask.make_response(MINIO.get(b, n))
 
 
 
 
354
 
355
  ext = re.search(r"\.([^.]+)$", doc.name)
356
  if ext: