diff options
Diffstat (limited to '')
-rw-r--r-- | remote_url.go | 6 | ||||
-rw-r--r-- | ssh_server.go | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/remote_url.go b/remote_url.go index f64d6ec..28d7dbe 100644 --- a/remote_url.go +++ b/remote_url.go @@ -2,13 +2,13 @@ package main import ( "net/url" - "strings" + "path" ) func generate_ssh_remote_url(group_name, repo_name string) string { - return strings.TrimSuffix(config.SSH.Root, "/") + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name) + return path.Join(config.SSH.Root, url.PathEscape(group_name), "/:/repos/", url.PathEscape(repo_name)) } func generate_http_remote_url(group_name, repo_name string) string { - return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name) + return path.Join(config.HTTP.Root, url.PathEscape(group_name), "/:/repos/", url.PathEscape(repo_name)) } diff --git a/ssh_server.go b/ssh_server.go index 206bf72..63ba467 100644 --- a/ssh_server.go +++ b/ssh_server.go @@ -4,6 +4,7 @@ import ( "fmt" "net" "os" + "path" "strings" glider_ssh "github.com/gliderlabs/ssh" @@ -41,7 +42,7 @@ func serve_ssh(listener net.Listener) error { } clog.Info("Incoming SSH: " + session.RemoteAddr().String() + " " + client_public_key_string + " " + session.RawCommand()) - fmt.Fprintln(session.Stderr(), "Lindenii Forge "+VERSION+", source at "+strings.TrimSuffix(config.HTTP.Root, "/")+"/:/source/\r") + fmt.Fprintln(session.Stderr(), "Lindenii Forge "+VERSION+", source at "+path.Join(config.HTTP.Root, "/:/source/\r")) cmd := session.Command() |