From 7625bd5ce9913fb715ec5211c1ff14b7f4851b6c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:32:28 -0500 Subject: [PATCH 1/4] fix url joining --- xclim/testing/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xclim/testing/utils.py b/xclim/testing/utils.py index dad66b212..31e7e3841 100644 --- a/xclim/testing/utils.py +++ b/xclim/testing/utils.py @@ -435,7 +435,9 @@ def load_registry( dict Dictionary of filenames and hashes. """ - remote_registry = audit_url(f"{repo}/{branch}/data/registry.txt") + if not branch.endswith("/"): + branch = f"{branch}/" + remote_registry = audit_url(urljoin(urljoin(repo, branch), "data/registry.txt")) if branch != default_testdata_version: custom_registry_folder = Path( @@ -511,8 +513,9 @@ def nimbus( # noqa: PR01 "The `pooch` package is required to fetch the xclim testing data. " "You can install it with `pip install pooch` or `pip install xclim[dev]`." ) - - remote = audit_url(f"{repo}/{branch}/data") + if not branch.endswith("/"): + branch = f"{branch}/" + remote = audit_url(urljoin(urljoin(repo, branch), "data")) return pooch.create( path=cache_dir, base_url=remote, From d7c8d46b412e13fa97b3a5e5b9793a1df89b2887 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:40:36 -0500 Subject: [PATCH 2/4] update CHANGELOG.rst --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f85d72b51..2a8b12374 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Breaking changes Bug fixes ^^^^^^^^^ * Fixed pickling issue with ``xclim.sdba.Grouper`` and other classes for usage with `dask>=2024.11`. (:issue:`1992`, :pull:`1993`). +* Fixed an issue with ``nimbus`` that was causing URL path components to be improperly joined. Internal changes ^^^^^^^^^^^^^^^^ From e5db3c5835c22f752da08158e5f8682ce84dfdcf Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:36:08 -0500 Subject: [PATCH 3/4] fix logic, update CHANGELOG.rst --- CHANGELOG.rst | 4 ++-- xclim/testing/utils.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2a8b12374..bc3d40b76 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,10 +13,10 @@ Breaking changes Bug fixes ^^^^^^^^^ * Fixed pickling issue with ``xclim.sdba.Grouper`` and other classes for usage with `dask>=2024.11`. (:issue:`1992`, :pull:`1993`). -* Fixed an issue with ``nimbus`` that was causing URL path components to be improperly joined. +* Fixed an issue with ``nimbus`` that was causing URL path components to be improperly joined. (:pull:`1997`). Internal changes -^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^v * Changed french translations with word "pluvieux" to "avec précipitations". (:issue:`1960`, :pull:`1994`). v0.53.2 (2024-10-31) diff --git a/xclim/testing/utils.py b/xclim/testing/utils.py index 31e7e3841..25a626bd7 100644 --- a/xclim/testing/utils.py +++ b/xclim/testing/utils.py @@ -435,9 +435,12 @@ def load_registry( dict Dictionary of filenames and hashes. """ - if not branch.endswith("/"): - branch = f"{branch}/" - remote_registry = audit_url(urljoin(urljoin(repo, branch), "data/registry.txt")) + remote_registry = audit_url( + urljoin( + urljoin(repo, branch if branch.endswith("/") else f"{branch}/"), + "data/registry.txt", + ) + ) if branch != default_testdata_version: custom_registry_folder = Path( @@ -513,9 +516,9 @@ def nimbus( # noqa: PR01 "The `pooch` package is required to fetch the xclim testing data. " "You can install it with `pip install pooch` or `pip install xclim[dev]`." ) - if not branch.endswith("/"): - branch = f"{branch}/" - remote = audit_url(urljoin(urljoin(repo, branch), "data")) + remote = audit_url( + urljoin(urljoin(repo, branch if branch.endswith("/") else f"{branch}/"), "data") + ) return pooch.create( path=cache_dir, base_url=remote, From 0e1630ab7ff4caffb45d533f48385dc3f436e45e Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:55:09 -0500 Subject: [PATCH 4/4] fix typo --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bc3d40b76..15dd45bfe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,7 @@ Bug fixes * Fixed an issue with ``nimbus`` that was causing URL path components to be improperly joined. (:pull:`1997`). Internal changes -^^^^^^^^^^^^^^^^v +^^^^^^^^^^^^^^^^ * Changed french translations with word "pluvieux" to "avec précipitations". (:issue:`1960`, :pull:`1994`). v0.53.2 (2024-10-31)