Update public source
This commit is contained in:
@@ -252,10 +252,34 @@ def create_result_package(
|
||||
|
||||
job_id = job["job_id"]
|
||||
|
||||
destination = (
|
||||
outbox / f"RESULT-{job_dir.name}.zip"
|
||||
package_filename_path = (
|
||||
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():
|
||||
raise ResultPackageError(
|
||||
f"Result package already exists: "
|
||||
@@ -263,7 +287,7 @@ def create_result_package(
|
||||
)
|
||||
|
||||
fd, temporary = tempfile.mkstemp(
|
||||
prefix=f".RESULT-{job_dir.name}.",
|
||||
prefix=f".{destination.stem}.",
|
||||
suffix=".zip.tmp",
|
||||
dir=str(outbox),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user