Skip to content

Commit

Permalink
When autodeteting URLs put https://git{hub,lab} back in
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Dec 15, 2023
1 parent 0013518 commit df6ed6a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion binderhub/static/js/src/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit df6ed6a

Please sign in to comment.