A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
switch to From: Header instead of date to compensate for older libmagic versions
phailc04b9fd7f6a6
diff --git a/src/paperless_mail/mail.py b/src/paperless_mail/mail.pyindex c834701b4..d52d86025 100644--- a/src/paperless_mail/mail.py+++ b/src/paperless_mail/mail.py@@ -342,7 +342,7 @@ class MailAccountHandler(LoggingMixin):suffix=".eml",)with open(temp_filename, "wb") as f:- # Move "Date"-header to beginning of file+ # Move "From"-header to beginning of file# TODO: This ugly workaround is needed because the parser is# chosen only by the mime_type detected via magic# (see documents/consumer.py "mime_type = magic.from_file")@@ -351,12 +351,12 @@ class MailAccountHandler(LoggingMixin):# detects text/plain.# This also effects direct file consumption of .eml files# which are not treated with this workaround.- date_element = None+ from_element = Nonefor i, header in enumerate(message.obj._headers):- if header[0] == "Date":- date_element = i- if date_element:- new_headers = [message.obj._headers.pop(date_element)]+ if header[0] == "From":+ from_element = i+ if from_element:+ new_headers = [message.obj._headers.pop(from_element)]new_headers += message.obj._headersmessage.obj._headers = new_headers