Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nimbus URL joining #1997

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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. (:pull:`1997`).

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
12 changes: 9 additions & 3 deletions xclim/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ def load_registry(
dict
Dictionary of filenames and hashes.
"""
remote_registry = audit_url(f"{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(
Expand Down Expand Up @@ -511,8 +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]`."
)

remote = audit_url(f"{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,
Expand Down
Loading