Skip to content

Commit af81d7f

Browse files
authored
Merge pull request #1779 from yuvipanda/base_url_trailing_slash
Guarantee that badge_base_url will always have a trailing /
2 parents 9f6ea44 + 2b9c13f commit af81d7f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

binderhub/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def get_badge_base_url(self):
172172
badge_base_url = self.settings["badge_base_url"]
173173
if callable(badge_base_url):
174174
badge_base_url = badge_base_url(self)
175+
# Make sure the url has a trailing slash
176+
if not badge_base_url.endswith("/"):
177+
badge_base_url += "/"
175178
return badge_base_url
176179

177180
def render_template(self, name, **extra_ns):

binderhub/static/js/src/constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const badge_base_url = document.getElementById("badge-base-url").dataset.url;
1515
* Base URL to use for both badge images as well as launch links.
1616
*
1717
* If not explicitly set, will default to BASE_URL. Primarily set up different than BASE_URL
18-
* when used as part of a federation
18+
* when used as part of a federation.
19+
*
20+
* Guaranteed to have a trailing slash by the binderhub python configuration.
1921
*/
2022
export const BADGE_BASE_URL = badge_base_url
2123
? new URL(badge_base_url, document.location.origin)

0 commit comments

Comments
 (0)