forked from NYANDEV/forgejo
Fix Go 1.13 private repository go get issue (#8112)
* Fix Go 1.13 invalid import path creation Signed-off-by: Rutger Broekhoff <rutger@viasalix.nl> * Apply suggested changes from #8100 Signed-off-by: Rutger Broekhoff <rutger@viasalix.nl>
This commit is contained in:
parent
c03d75fbd5
commit
88e1c29df1
2 changed files with 20 additions and 3 deletions
|
@ -201,10 +201,14 @@ func ComposeGoGetImport(owner, repo string) string {
|
|||
// .netrc file.
|
||||
func EarlyResponseForGoGetMeta(ctx *Context) {
|
||||
username := ctx.Params(":username")
|
||||
reponame := ctx.Params(":reponame")
|
||||
reponame := strings.TrimSuffix(ctx.Params(":reponame"), ".git")
|
||||
if username == "" || reponame == "" {
|
||||
ctx.PlainText(400, []byte("invalid repository path"))
|
||||
return
|
||||
}
|
||||
ctx.PlainText(200, []byte(com.Expand(`<meta name="go-import" content="{GoGetImport} git {CloneLink}">`,
|
||||
map[string]string{
|
||||
"GoGetImport": ComposeGoGetImport(username, strings.TrimSuffix(reponame, ".git")),
|
||||
"GoGetImport": ComposeGoGetImport(username, reponame),
|
||||
"CloneLink": models.ComposeHTTPSCloneURL(username, reponame),
|
||||
})))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue