From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:20:40 +0000 (-0800) Subject: Be sure the scratch directory exists before using it as temporary directory X-Git-Tag: v1.14.0-beta.rc1~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c422a081bf515ffbb0ad162f40785874c010cbdc;p=thirdparty%2Fpaperless-ngx.git Be sure the scratch directory exists before using it as temporary directory --- diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py index fdea8aff64..427cd4ef2d 100644 --- a/src/documents/management/commands/document_exporter.py +++ b/src/documents/management/commands/document_exporter.py @@ -156,11 +156,13 @@ class Command(BaseCommand): zip_export: bool = options["zip"] # If zipping, save the original target for later and - # get a temporary directory for the target + # get a temporary directory for the target instead temp_dir = None original_target = None if zip_export: original_target = self.target + + os.makedirs(settings.SCRATCH_DIR, exist_ok=True) temp_dir = tempfile.TemporaryDirectory( dir=settings.SCRATCH_DIR, prefix="paperless-export",