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

Encode branch name when creating a Binder link #215

Open
jtpio opened this issue Dec 11, 2023 · 0 comments
Open

Encode branch name when creating a Binder link #215

jtpio opened this issue Dec 11, 2023 · 0 comments

Comments

@jtpio
Copy link
Member

jtpio commented Dec 11, 2023

Currently the PR_HEAD_REF is taken as is and passed to the Binder link:

var PR_HEAD_REF = process.env.PR_HEAD_REF;
var URL_PATH = process.env.URL_PATH;
var BODY = `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=${URL_PATH}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`;

However this can create issues when a branch has a special character, for example #, as noticed in jupyter/notebook#7178. The Binder link becomes https://mybinder.org/v2/gh/haok1402/notebook/issue#7147?urlpath=tree, but Binder fails to build it:

image

However Binder can build the repo fine if the special character is URL encoded: https://mybinder.org/v2/gh/haok1402/notebook/issue%237147

image

So this binder-link action should probably try to encode the PR_HEAD_REF before creating the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant