Use mkstemp

This commit is contained in:
shamoon
2026-01-26 17:17:41 -08:00
parent 4f8d12d170
commit 517349c3af

View File

@@ -5,8 +5,8 @@ import shutil
import uuid import uuid
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from tempfile import NamedTemporaryFile
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from tempfile import mkstemp
import tqdm import tqdm
from celery import Task from celery import Task
@@ -663,12 +663,8 @@ def build_share_link_bundle(bundle_id: int):
documents = list(bundle.documents.all().order_by("pk")) documents = list(bundle.documents.all().order_by("pk"))
with NamedTemporaryFile( _, temp_zip_path_str = mkstemp(suffix=".zip", dir=settings.SCRATCH_DIR)
dir=settings.SCRATCH_DIR, temp_zip_path = Path(temp_zip_path_str)
suffix=".zip",
delete=False,
) as temp_zip:
temp_zip_path = Path(temp_zip.name)
try: try:
strategy_class = ( strategy_class = (