mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-27 15:35:14 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f80f4608c |
@@ -2,6 +2,7 @@ import datetime
|
|||||||
import imaplib
|
import imaplib
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -1135,12 +1136,12 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
doc_type,
|
doc_type,
|
||||||
):
|
):
|
||||||
settings.SCRATCH_DIR.mkdir(parents=True, exist_ok=True)
|
settings.SCRATCH_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
_, temp_filename = tempfile.mkstemp(
|
fd, temp_filename = tempfile.mkstemp(
|
||||||
prefix="paperless-mail-",
|
prefix="paperless-mail-",
|
||||||
dir=settings.SCRATCH_DIR,
|
dir=settings.SCRATCH_DIR,
|
||||||
suffix=".eml",
|
suffix=".eml",
|
||||||
)
|
)
|
||||||
with Path(temp_filename).open("wb") as f:
|
with os.fdopen(fd, "wb") as f:
|
||||||
# Move "From"-header to beginning of file
|
# Move "From"-header to beginning of file
|
||||||
# TODO: This ugly workaround is needed because the parser is
|
# TODO: This ugly workaround is needed because the parser is
|
||||||
# chosen only by the mime_type detected via magic
|
# chosen only by the mime_type detected via magic
|
||||||
|
|||||||
Reference in new issue
Block a user