Bug fix - email processing could be run now from API (#2613)

### What problem does this PR solve?

If .eml file is uploaded, there is always General method chosen for
email processing, even if parsing_method is defined in the request. This
change solves this issue.

### Type of change

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

Co-authored-by: Adam Kobus <adam.kobus@gitlab.eleader.biz>
This commit is contained in:
adam-kobus 2024-09-27 04:24:46 +02:00 committed by GitHub
parent 35598c04ce
commit b16f16e19e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -454,6 +454,8 @@ def upload():
doc["parser_id"] = ParserType.AUDIO.value doc["parser_id"] = ParserType.AUDIO.value
if re.search(r"\.(ppt|pptx|pages)$", filename): if re.search(r"\.(ppt|pptx|pages)$", filename):
doc["parser_id"] = ParserType.PRESENTATION.value doc["parser_id"] = ParserType.PRESENTATION.value
if re.search(r"\.(eml)$", filename):
doc["parser_id"] = ParserType.EMAIL.value
doc_result = DocumentService.insert(doc) doc_result = DocumentService.insert(doc)
FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id) FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)