From 1bdc17735a82f16da6582c8eb5c6db422bcbc524 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 5 Mar 2024 20:17:59 -0500 Subject: [PATCH] Ensure that artifact url is valid for Windows dist manifest (#4508) Signed-off-by: Peter Zhu --- src/assemble_workflow/bundle_url_location.py | 6 +++++- .../test_bundle_url_location.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/assemble_workflow/bundle_url_location.py b/src/assemble_workflow/bundle_url_location.py index 7603ba7afc..91d2f0dcc0 100644 --- a/src/assemble_workflow/bundle_url_location.py +++ b/src/assemble_workflow/bundle_url_location.py @@ -16,4 +16,8 @@ def __init__(self, path: str, filename: str, distribution: str) -> None: def join(self, *args: str) -> str: sub_path = "/".join(args) - return urljoin(self.path + "/", sub_path) + + # Make sure \ is replaced with / for valid url + # We will only make change here as the location can be either local or url + # Thus keep \ if it is a local path + return urljoin(self.path + "/", sub_path.replace("\\", "/")) diff --git a/tests/tests_assemble_workflow/test_bundle_url_location.py b/tests/tests_assemble_workflow/test_bundle_url_location.py index cbfafb8107..9821fc9fc9 100644 --- a/tests/tests_assemble_workflow/test_bundle_url_location.py +++ b/tests/tests_assemble_workflow/test_bundle_url_location.py @@ -49,3 +49,16 @@ def test_opensearch_dashboards(self) -> None: location.get_build_location("sql"), "https://ci.opensearch.org/ci/dbc/bundle-build/1.3.0/1318/linux/x64/tar/builds/opensearch-dashboards/sql" ) + + def test_opensearch_windows(self) -> None: + location = BundleUrlLocation("https://ci.opensearch.org/ci/dbc/bundle-build/1.3.0/1318/windows/x64", "opensearch", "plugins\\zip") + + self.assertEqual( + location.get_bundle_location("sql"), + "https://ci.opensearch.org/ci/dbc/bundle-build/1.3.0/1318/windows/x64/plugins/zip/dist/opensearch/sql" + ) + + self.assertEqual( + location.get_build_location("sql"), + "https://ci.opensearch.org/ci/dbc/bundle-build/1.3.0/1318/windows/x64/plugins/zip/builds/opensearch/sql" + )