mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
eml parsing requires tika
This commit is contained in:
parent
d132eba143
commit
ebe21a0114
@ -1,4 +1,5 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from paperless_mail.signals import mail_consumer_declaration
|
from paperless_mail.signals import mail_consumer_declaration
|
||||||
|
|
||||||
@ -11,5 +12,6 @@ class PaperlessMailConfig(AppConfig):
|
|||||||
def ready(self):
|
def ready(self):
|
||||||
from documents.signals import document_consumer_declaration
|
from documents.signals import document_consumer_declaration
|
||||||
|
|
||||||
document_consumer_declaration.connect(mail_consumer_declaration)
|
if settings.TIKA_ENABLED:
|
||||||
|
document_consumer_declaration.connect(mail_consumer_declaration)
|
||||||
AppConfig.ready(self)
|
AppConfig.ready(self)
|
||||||
|
@ -159,7 +159,12 @@ class MailDocumentParser(DocumentParser):
|
|||||||
|
|
||||||
pdf_collection.append(("1_mail.pdf", self.generate_pdf_from_mail(mail)))
|
pdf_collection.append(("1_mail.pdf", self.generate_pdf_from_mail(mail)))
|
||||||
|
|
||||||
if mail.html != "":
|
if mail.html == "":
|
||||||
|
with open(pdf_path, "wb") as file:
|
||||||
|
file.write(pdf_collection[0][1])
|
||||||
|
file.close()
|
||||||
|
return pdf_path
|
||||||
|
else:
|
||||||
pdf_collection.append(
|
pdf_collection.append(
|
||||||
(
|
(
|
||||||
"2_html.pdf",
|
"2_html.pdf",
|
||||||
@ -167,12 +172,6 @@ class MailDocumentParser(DocumentParser):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(pdf_collection) == 1:
|
|
||||||
with open(pdf_path, "wb") as file:
|
|
||||||
file.write(pdf_collection[0][1])
|
|
||||||
file.close()
|
|
||||||
return pdf_path
|
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
for name, content in pdf_collection:
|
for name, content in pdf_collection:
|
||||||
files[name] = (name, BytesIO(content))
|
files[name] = (name, BytesIO(content))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user