diff options
author | Lauris BH <lauris@nix.lv> | 2019-01-30 23:29:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-30 23:29:44 +0200 |
commit | 3f802a28464491b6b9b84579bac4fec53d4586db (patch) | |
tree | 9e07fced58dc94aa25579f9f5e9462bd96590eb1 /modules/context | |
parent | 0190d3c243db391e7d9df5726449f5e44534e950 (diff) | |
download | gitea-3f802a28464491b6b9b84579bac4fec53d4586db.tar.gz gitea-3f802a28464491b6b9b84579bac4fec53d4586db.zip |
Fix go-get URL generation (#5905) (#5907)
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/context.go | 2 | ||||
-rw-r--r-- | modules/context/repo.go | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index b9736e56ef..421d1d5f4f 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -209,7 +209,7 @@ func Contexter() macaron.Handler { if err == nil && len(repo.DefaultBranch) > 0 { branchName = repo.DefaultBranch } - prefix := setting.AppURL + path.Join(ownerName, repoName, "src", "branch", branchName) + prefix := setting.AppURL + path.Join(url.QueryEscape(ownerName), url.QueryEscape(repoName), "src", "branch", branchName) c.Header().Set("Content-Type", "text/html") c.WriteHeader(http.StatusOK) c.Write([]byte(com.Expand(`<!doctype html> diff --git a/modules/context/repo.go b/modules/context/repo.go index 55d607a28a..ad910caf18 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -8,6 +8,7 @@ package context import ( "fmt" "io/ioutil" + "net/url" "path" "strings" @@ -162,7 +163,7 @@ func RetrieveBaseRepo(ctx *Context, repo *models.Repository) { // ComposeGoGetImport returns go-get-import meta content. func ComposeGoGetImport(owner, repo string) string { - return path.Join(setting.Domain, setting.AppSubURL, owner, repo) + return path.Join(setting.Domain, setting.AppSubURL, url.QueryEscape(owner), url.QueryEscape(repo)) } // EarlyResponseForGoGetMeta responses appropriate go-get meta with status 200 |