aboutsummaryrefslogtreecommitdiff
path: root/remote_url.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-17 12:05:52 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-17 12:05:52 +0800
commit5c80236c0ed27af9db42b6d5b60f0d365457c7a4 (patch)
tree4e2dfa054eb0e04aeba99130af18b3c5e85ac104 /remote_url.go
parentmisc.go: Remove environ_to_map as unused (diff)
downloadforge-5c80236c0ed27af9db42b6d5b60f0d365457c7a4.tar.gz
forge-5c80236c0ed27af9db42b6d5b60f0d365457c7a4.tar.zst
forge-5c80236c0ed27af9db42b6d5b60f0d365457c7a4.zip
{remote_url,ssh_server}.go: Use path.Join instead of trimming and adding
Diffstat (limited to 'remote_url.go')
-rw-r--r--remote_url.go6
1 files changed, 3 insertions, 3 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))
}