Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fixes generation of thumbnails when the archive file hasn't already been created

Trenton H0d6e79cb9373
diff --git a/src/paperless_mail/parsers.py b/src/paperless_mail/parsers.py
index dec2b4754..1fcc89188 100644
--- a/src/paperless_mail/parsers.py
+++ b/src/paperless_mail/parsers.py
@@ -33,7 +33,9 @@ class MailDocumentParser(DocumentParser):
def get_thumbnail(self, document_path: Path, mime_type: str, file_name=None):
if not self.archive_path:
- self.archive_path = self.generate_pdf(document_path)
+ self.archive_path = self.generate_pdf(
+ self.parse_file_to_message(document_path),
+ )
return make_thumbnail_from_pdf(
self.archive_path,
@@ -300,9 +302,6 @@ class MailDocumentParser(DocumentParser):
css_file = Path(__file__).parent / "templates" / "output.css"
email_html_file = self.mail_to_html(mail)
- print(css_file)
- print(email_html_file)
-
with css_file.open("rb") as css_handle, email_html_file.open(
"rb",
) as email_html_handle:
diff --git a/src/paperless_mail/tests/test_parsers.py b/src/paperless_mail/tests/test_parsers.py
index 7b7d2463a..41787adda 100644
--- a/src/paperless_mail/tests/test_parsers.py
+++ b/src/paperless_mail/tests/test_parsers.py
@@ -293,9 +293,7 @@ class TestEmailThumbnailGenerate(BaseMailParserTestCase):
"message/rfc822",
)
- mock_generate_pdf.assert_called_once_with(
- test_file,
- )
+ mock_generate_pdf.assert_called_once()
mock_make_thumbnail_from_pdf.assert_called_once_with(
"Mocked return value..",
self.parser.tempdir,