diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 19:45:17 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 19:45:17 +0800 |
commit | 54a19febc0c7c49caa014254cabab571abad60ab (patch) | |
tree | a0b5ffe5aaaff956d5d41b09ca1d2127f771d17a /remote_url.go | |
parent | git2c: Fix regression in potential integer overflow (diff) | |
download | forge-54a19febc0c7c49caa014254cabab571abad60ab.tar.gz forge-54a19febc0c7c49caa014254cabab571abad60ab.tar.zst forge-54a19febc0c7c49caa014254cabab571abad60ab.zip |
misc: Move url.go into the misc package
Diffstat (limited to 'remote_url.go')
-rw-r--r-- | remote_url.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/remote_url.go b/remote_url.go index 5c980f5..f227dbf 100644 --- a/remote_url.go +++ b/remote_url.go @@ -6,6 +6,8 @@ package main import ( "net/url" "strings" + + "go.lindenii.runxiyu.org/forge/misc" ) // We don't use path.Join because it collapses multiple slashes into one. @@ -13,11 +15,11 @@ import ( // genSSHRemoteURL generates SSH remote URLs from a given group path and repo // name. func genSSHRemoteURL(groupPath []string, repoName string) string { - return strings.TrimSuffix(config.SSH.Root, "/") + "/" + segmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) + return strings.TrimSuffix(config.SSH.Root, "/") + "/" + misc.SegmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) } // genHTTPRemoteURL generates HTTP remote URLs from a given group path and repo // name. func genHTTPRemoteURL(groupPath []string, repoName string) string { - return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + segmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) + return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + misc.SegmentsToURL(groupPath) + "/-/repos/" + url.PathEscape(repoName) } |