Update public source

This commit is contained in:
2026-11-12 10:08:44 +03:00
parent 22c3c8b9bb
commit a9358fec17
+27 -3
View File
@@ -252,10 +252,34 @@ def create_result_package(
job_id = job["job_id"] job_id = job["job_id"]
destination = ( package_filename_path = (
outbox / f"RESULT-{job_dir.name}.zip" job_dir / "package_filename.txt"
) )
result_filename = f"RESULT-{job_dir.name}.zip"
if package_filename_path.is_file():
package_filename = (
package_filename_path.read_text(
encoding="utf-8"
)
)
if (
not package_filename.startswith("JOB-")
or not package_filename.endswith(".zip")
or Path(package_filename).name != package_filename
):
raise ResultPackageError(
"Invalid original Job package filename."
)
result_filename = (
f"RESULT-{package_filename.removeprefix('JOB-')}"
)
destination = outbox / result_filename
if destination.exists(): if destination.exists():
raise ResultPackageError( raise ResultPackageError(
f"Result package already exists: " f"Result package already exists: "
@@ -263,7 +287,7 @@ def create_result_package(
) )
fd, temporary = tempfile.mkstemp( fd, temporary = tempfile.mkstemp(
prefix=f".RESULT-{job_dir.name}.", prefix=f".{destination.stem}.",
suffix=".zip.tmp", suffix=".zip.tmp",
dir=str(outbox), dir=str(outbox),
) )