diff --git a/antarest/launcher/service.py b/antarest/launcher/service.py index 3a50cf91cb..a8e12e4da7 100644 --- a/antarest/launcher/service.py +++ b/antarest/launcher/service.py @@ -474,9 +474,9 @@ def _import_output( study_id = job_result.study_id job_launch_params = LauncherParametersDTO.parse_raw(job_result.launcher_params or "{}") - # this now can be a zip file instead of a directory ! + # this now can be a zip file instead of a directory! output_true_path = retrieve_output_path(output_path) - output_is_zipped = is_zip(output_true_path) + output_is_zipped = output_true_path.suffix.lower() == ".zip" output_suffix = cast( Optional[str], getattr( diff --git a/antarest/study/storage/utils.py b/antarest/study/storage/utils.py index f429fc5e55..50f12e996c 100644 --- a/antarest/study/storage/utils.py +++ b/antarest/study/storage/utils.py @@ -115,14 +115,17 @@ def fix_study_root(study_path: Path) -> None: def retrieve_output_path(job_path: Path) -> Path: - inside_study_output_path = job_path / "output" output_already_zipped_path = job_path.with_suffix(".zip") if output_already_zipped_path.exists(): return output_already_zipped_path - elif inside_study_output_path.exists() and len(os.listdir(inside_study_output_path)) == 1: - return inside_study_output_path / os.listdir(str(inside_study_output_path))[0] - else: - return Path() + + output_inside_study = job_path / "output" + if output_inside_study.is_dir(): + output_folders = os.listdir(output_inside_study) + if len(output_folders) == 1: + return output_inside_study / output_folders[0] + + return Path() def extract_output_name(path_output: Path, new_suffix_name: Optional[str] = None) -> str: