Return go-get info on subdirs #15642

Merged
lunny merged 8 commits from fix-15625-go-get-handler into main 2021-05-09 21:50:07 +00:00
Contributor

This PR is an alternative to #15628 and makes the go get handler a
handler.

Fix #15625

Close #15628

Signed-off-by: Andrew Thornton art27@cantab.net

This PR is an alternative to #15628 and makes the go get handler a handler. Fix #15625 Close #15628 Signed-off-by: Andrew Thornton <art27@cantab.net>
jolheiser reviewed 2021-04-27 20:17:15 +00:00
@ -0,0 +14,4 @@
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"github.com/unknwon/com"
Contributor

Just because you're already fiddling here, maybe we could replace com.Expand with os.Expand? ?

Just because you're already fiddling here, maybe we could replace `com.Expand` with `os.Expand`? ?
jolheiser reviewed 2021-04-27 20:22:03 +00:00
@ -0,0 +18,4 @@
)
func goGet(ctx *context.Context) {
if ctx.Req.Method != "GET" || ctx.Query("go-get") != "1" || len(ctx.Req.URL.Query()) > 1 {
Contributor

Wouldn't len(ctx.Req.URL.Query()) > 1 always be true for ?go-get=1

Wouldn't `len(ctx.Req.URL.Query()) > 1` always be true for `?go-get=1`
zeripath reviewed 2021-04-27 20:24:18 +00:00
@ -0,0 +18,4 @@
)
func goGet(ctx *context.Context) {
if ctx.Req.Method != "GET" || ctx.Query("go-get") != "1" || len(ctx.Req.URL.Query()) > 1 {
Author
Contributor

> 1 not > 0 ... this is so that it only fires if there is only 1 query param - go-get=1

`> 1` not `> 0` ... this is so that it only fires if there is only 1 query param - go-get=1
jolheiser reviewed 2021-04-27 20:25:54 +00:00
@ -0,0 +18,4 @@
)
func goGet(ctx *context.Context) {
if ctx.Req.Method != "GET" || ctx.Query("go-get") != "1" || len(ctx.Req.URL.Query()) > 1 {
Contributor

Aha, sorry I was thinking it returned the query-string. I see it returns url.Values.

Aha, sorry I was thinking it returned the query-string. I see it returns `url.Values`.
zeripath reviewed 2021-04-27 20:29:15 +00:00
@ -0,0 +14,4 @@
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"github.com/unknwon/com"
Author
Contributor

it's doing something different from os.Expand.

It might be better to actually change this to use a go-template instead.

it's doing something different from os.Expand. It might be better to actually change this to use a go-template instead.
jolheiser reviewed 2021-04-27 20:30:04 +00:00
@ -0,0 +14,4 @@
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"github.com/unknwon/com"
Contributor

Both are used to expand variables in strings. A template would also work.

Both are used to expand variables in strings. A template would also work.
techknowlogick approved these changes 2021-05-03 18:04:37 +00:00
6543 (Migrated from github.com) approved these changes 2021-05-09 20:49:11 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
4 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#15642
No description provided.