mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fixes generation of thumbnails when the archive file hasn't already been created
This commit is contained in:
		| @@ -33,7 +33,9 @@ class MailDocumentParser(DocumentParser): | |||||||
|  |  | ||||||
|     def get_thumbnail(self, document_path: Path, mime_type: str, file_name=None): |     def get_thumbnail(self, document_path: Path, mime_type: str, file_name=None): | ||||||
|         if not self.archive_path: |         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( |         return make_thumbnail_from_pdf( | ||||||
|             self.archive_path, |             self.archive_path, | ||||||
| @@ -300,9 +302,6 @@ class MailDocumentParser(DocumentParser): | |||||||
|         css_file = Path(__file__).parent / "templates" / "output.css" |         css_file = Path(__file__).parent / "templates" / "output.css" | ||||||
|         email_html_file = self.mail_to_html(mail) |         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( |         with css_file.open("rb") as css_handle, email_html_file.open( | ||||||
|             "rb", |             "rb", | ||||||
|         ) as email_html_handle: |         ) as email_html_handle: | ||||||
|   | |||||||
| @@ -293,9 +293,7 @@ class TestEmailThumbnailGenerate(BaseMailParserTestCase): | |||||||
|             "message/rfc822", |             "message/rfc822", | ||||||
|         ) |         ) | ||||||
|  |  | ||||||
|         mock_generate_pdf.assert_called_once_with( |         mock_generate_pdf.assert_called_once() | ||||||
|             test_file, |  | ||||||
|         ) |  | ||||||
|         mock_make_thumbnail_from_pdf.assert_called_once_with( |         mock_make_thumbnail_from_pdf.assert_called_once_with( | ||||||
|             "Mocked return value..", |             "Mocked return value..", | ||||||
|             self.parser.tempdir, |             self.parser.tempdir, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trenton H
					Trenton H