diff --git a/binderhub/static/js/src/repo.js b/binderhub/static/js/src/repo.js index 42004f72f..d0ce58499 100644 --- a/binderhub/static/js/src/repo.js +++ b/binderhub/static/js/src/repo.js @@ -35,11 +35,21 @@ export function updateRepoText(baseUrl) { export async function detectPastedRepo(baseUrl) { const repoField = $("#repository").val().trim(); const fields = await detect(baseUrl, repoField); + // Special case: The BinderHub UI supports https://git{hub,lab}.com/ in the + // repository (it's stripped out later in the UI). + // To keep the UI consistent insert it back if it was originally included. console.log(fields); if (fields) { + let repo = fields.repository; + if (repoField.startsWith("https://github.com/")) { + repo = "https://github.com/" + repo; + } + if (repoField.startsWith("https://gitlab.com/")) { + repo = "https://gitlab.com/" + repo; + } $("#provider_prefix-selected").text(fields.providerName); $("#provider_prefix").val(fields.providerPrefix); - $("#repository").val(fields.repository); + $("#repository").val(repo); if (fields.ref) { $("#ref").val(fields.ref); }