diff --git a/src/webui/WebUI.jl b/src/webui/WebUI.jl index 4fe5dcd875..685d80adba 100644 --- a/src/webui/WebUI.jl +++ b/src/webui/WebUI.jl @@ -112,8 +112,8 @@ function init_registry() repo = @gf get_repo(forge, owner, name) repo === nothing && error("Registry lookup failed") - clone = get(CONFIG, "registry_clone_url", url) - fork_url = get(CONFIG, "registry_fork_url", clone) + clone = remove_ssh_prefix(get(CONFIG, "registry_clone_url", url)) + fork_url = remove_ssh_prefix(get(CONFIG, "registry_fork_url", clone)) fork_owner, fork_name = splitrepo(fork_url) fork_repo = @gf get_repo(forge, fork_owner, fork_name) fork_repo === nothing && error("Registry fork lookup failed") diff --git a/src/webui/gitutils.jl b/src/webui/gitutils.jl index fc2fb38750..fd84eb6966 100644 --- a/src/webui/gitutils.jl +++ b/src/webui/gitutils.jl @@ -14,7 +14,12 @@ end # Split a repo path into its owner and name. function splitrepo(url::AbstractString) - pieces = split(HTTP.URI(url).path, "/"; keepempty=false) + if startswith(url, "https://") || startswith(url, "http://") + pieces = split(HTTP.URI(url).path, "/"; keepempty=false) + else + pieces = split(split(url, ":")[end], "/") + end + owner = join(pieces[1:end-1], "/") name = pieces[end] return owner, name diff --git a/src/webui/webutils.jl b/src/webui/webutils.jl index e45beadf9a..80124c464c 100644 --- a/src/webui/webutils.jl +++ b/src/webui/webutils.jl @@ -40,3 +40,5 @@ function parseform(s::AbstractString) pairs = split(replace(s, "+" => " "), "&") return Dict(map(p -> map(strip ∘ HTTP.unescapeuri, split(p, "=")), pairs)) end + +remove_ssh_prefix(s::AbstractString) = startswith(s, "ssh://") ? s[length("ssh://")+1:end] : s