-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Go 1.13 private repository go get issue #8100
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -201,10 +201,14 @@ func ComposeGoGetImport(owner, repo string) string { | |||
// .netrc file. | ||||
func EarlyResponseForGoGetMeta(ctx *Context) { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here we can check previously to calling this method and maybe pass Line 58 in 85202d4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it not be preferable to add this for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess not because it seems possible to have the suffix |
||||
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), | ||||
}))) | ||||
} | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if returned error, you should give a 500 I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not see the problem the other way and simply ignore go-get params instead of erroring ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be break down in two
if
obviously.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But else we still need return 404 but not continue the other work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once
ctx.Query("go-get") == "1"
, it should return anyway here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a 400 should be returned because in this case the client has not provided adequate information for the server to provide an import URL from the its request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitea/routers/repo/http.go
Line 58 in 85202d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps in
trimmedRepoName
, such that this is not interfered with:gitea/modules/context/context.go
Line 258 in bb609ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we should return an error ? For exemple github doesn't trigger an error on an profile if you use go-get param. Futhermore triggering an error from a supervision point could be misleading. I will not block as it need a quick fix.