diff --git a/lib/galaxy/tool_util/cwl/util.py b/lib/galaxy/tool_util/cwl/util.py index 71e993a3efa6..4c57663cb090 100644 --- a/lib/galaxy/tool_util/cwl/util.py +++ b/lib/galaxy/tool_util/cwl/util.py @@ -625,7 +625,11 @@ def dir_listing(dir_path): "basename": basename, "listing": listing, } - _handle_pseudo_location(properties, pseudo_location=pseudo_location, download_url=output_metadata["download_url"] + "?to_ext=directory") + _handle_pseudo_location( + properties, + pseudo_location=pseudo_location, + download_url=output_metadata["download_url"] + "?to_ext=directory", + ) extra_files = get_extra_files(output_metadata) for extra_file in extra_files: diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index 764f51fd124d..b4acb65be5ff 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -266,6 +266,14 @@ def conformance_tests_gen(directory, filename="conformance_tests.yaml"): yield conformance_test +def to_local_location(listing, location): + for item in listing: + if "basename" in item: + item["location"] = f"file://{os.path.join(location[len('file://'):], item['basename'])}" + if "listing" in item: + to_local_location(item["listing"], location=item["location"]) + + def output_to_disk(output, download_folder): if isinstance(output, dict): if "secondaryFiles" in output: @@ -274,9 +282,17 @@ def output_to_disk(output, download_folder): ] if "basename" in output: download_path = os.path.join(download_folder, output["basename"]) - download_to_file(output["location"], download_path) + if output["class"] == "Directory": + zip_path = f"{download_path}.zip" + download_to_file(output["location"], zip_path) + CompressedFile(zip_path).extract(download_folder) + os.remove(zip_path) + else: + download_to_file(output["location"], download_path) output["path"] = download_path output["location"] = f"file://{download_path}" + if "listing" in output: + to_local_location(output["listing"], output["location"]) return output else: new_output = {}