From 62e921486c7ea01f87ca5f546fd0b5c30a7db01f Mon Sep 17 00:00:00 2001 From: gereon Date: Tue, 8 Apr 2025 15:05:13 +0200 Subject: [PATCH 1/3] added safe="" parameter to match binderhub expectations --- src/sphinx_book_theme/header_buttons/launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 20f93b4c..14641b34 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -120,7 +120,7 @@ def add_launch_buttons( # Any non-standard repository URL should be passed-through raw if provider_url not in ["https://github.com", "https://gitlab.com"]: # Generic git repository using the full repo URL as a fallback - url = f"{binderhub_url}/v2/git/{quote(repo_url)}/{branch}" + url = f"{binderhub_url}/v2/git/{quote(repo_url, safe="")}/{branch}" elif provider.lower() == "github": url = f"{binderhub_url}/v2/gh/{org}/{repo}/{branch}" elif provider.lower() == "gitlab": From 0e8867c742e31f17a61fc797d5d3533a880aa833 Mon Sep 17 00:00:00 2001 From: gereon Date: Tue, 8 Apr 2025 16:03:09 +0200 Subject: [PATCH 2/3] fix quotation marks --- src/sphinx_book_theme/header_buttons/launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 14641b34..1cab0712 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -120,7 +120,7 @@ def add_launch_buttons( # Any non-standard repository URL should be passed-through raw if provider_url not in ["https://github.com", "https://gitlab.com"]: # Generic git repository using the full repo URL as a fallback - url = f"{binderhub_url}/v2/git/{quote(repo_url, safe="")}/{branch}" + url = f"{binderhub_url}/v2/git/{quote(repo_url, safe='')}/{branch}" elif provider.lower() == "github": url = f"{binderhub_url}/v2/gh/{org}/{repo}/{branch}" elif provider.lower() == "gitlab": From 1766250fc7675944a8a580383937e4c4b8d32b15 Mon Sep 17 00:00:00 2001 From: zergar Date: Tue, 8 Apr 2025 21:10:23 +0200 Subject: [PATCH 3/3] adapted test base to use correct URL Signed-off-by: zergar --- tests/test_build/header__launch-buttons--bitbucket.html | 4 ++-- tests/test_build/header__launch-buttons--gitlab_manual.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_build/header__launch-buttons--bitbucket.html b/tests/test_build/header__launch-buttons--bitbucket.html index f6447ef3..c689490d 100644 --- a/tests/test_build/header__launch-buttons--bitbucket.html +++ b/tests/test_build/header__launch-buttons--bitbucket.html @@ -1,7 +1,7 @@ section1/ntbk.html -https://mybinder.org/v2/git/https%3A//opensource.ncsa.illinois.edu/bitbucket/scm/u3d/3dutilities/foo?urlpath=tree/docs/section1/ntbk.ipynb +https://mybinder.org/v2/git/https%3A%2F%2Fopensource.ncsa.illinois.edu%2Fbitbucket%2Fscm%2Fu3d%2F3dutilities/foo?urlpath=tree/docs/section1/ntbk.ipynb https://hub.myorg.edu/hub/user-redirect/git-pull?repo=https%3A//opensource.ncsa.illinois.edu/bitbucket/scm/u3d/3dutilities&urlpath=tree/3dutilities/docs/section1/ntbk.ipynb&branch=foo section1/ntbkmd.html -https://mybinder.org/v2/git/https%3A//opensource.ncsa.illinois.edu/bitbucket/scm/u3d/3dutilities/foo?urlpath=tree/docs/section1/ntbkmd.md +https://mybinder.org/v2/git/https%3A%2F%2Fopensource.ncsa.illinois.edu%2Fbitbucket%2Fscm%2Fu3d%2F3dutilities/foo?urlpath=tree/docs/section1/ntbkmd.md https://hub.myorg.edu/hub/user-redirect/git-pull?repo=https%3A//opensource.ncsa.illinois.edu/bitbucket/scm/u3d/3dutilities&urlpath=tree/3dutilities/docs/section1/ntbkmd.md&branch=foo diff --git a/tests/test_build/header__launch-buttons--gitlab_manual.html b/tests/test_build/header__launch-buttons--gitlab_manual.html index 962286d6..1d81c79c 100644 --- a/tests/test_build/header__launch-buttons--gitlab_manual.html +++ b/tests/test_build/header__launch-buttons--gitlab_manual.html @@ -1,7 +1,7 @@ section1/ntbk.html -https://mybinder.org/v2/git/https%3A//mywebsite.com/gitlab/gitlab-org/gitlab/foo?urlpath=tree/docs/section1/ntbk.ipynb +https://mybinder.org/v2/git/https%3A%2F%2Fmywebsite.com%2Fgitlab%2Fgitlab-org%2Fgitlab/foo?urlpath=tree/docs/section1/ntbk.ipynb https://hub.myorg.edu/hub/user-redirect/git-pull?repo=https%3A//mywebsite.com/gitlab/gitlab-org/gitlab&urlpath=tree/gitlab/docs/section1/ntbk.ipynb&branch=foo section1/ntbkmd.html -https://mybinder.org/v2/git/https%3A//mywebsite.com/gitlab/gitlab-org/gitlab/foo?urlpath=tree/docs/section1/ntbkmd.md +https://mybinder.org/v2/git/https%3A%2F%2Fmywebsite.com%2Fgitlab%2Fgitlab-org%2Fgitlab/foo?urlpath=tree/docs/section1/ntbkmd.md https://hub.myorg.edu/hub/user-redirect/git-pull?repo=https%3A//mywebsite.com/gitlab/gitlab-org/gitlab&urlpath=tree/gitlab/docs/section1/ntbkmd.md&branch=foo