diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 20f93b4c..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)}/{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": 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