From a62148a889bc00cb4c71eb8c1f2e17375303d804 Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Thu, 2 Jan 2020 16:00:40 -0300 Subject: [PATCH 1/2] Fix error logged when repos qs is empty --- routers/user/home.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/routers/user/home.go b/routers/user/home.go index ae5975a711c6b..e38196694d61a 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -389,21 +389,23 @@ func Issues(ctx *context.Context) { reposQuery := ctx.Query("repos") var repoIDs []int64 - if issueReposQueryPattern.MatchString(reposQuery) { - // remove "[" and "]" from string - reposQuery = reposQuery[1 : len(reposQuery)-1] - //for each ID (delimiter ",") add to int to repoIDs - for _, rID := range strings.Split(reposQuery, ",") { - // Ensure nonempty string entries - if rID != "" && rID != "0" { - rIDint64, err := strconv.ParseInt(rID, 10, 64) - if err == nil { - repoIDs = append(repoIDs, rIDint64) + if(reposQuery != "") { + if issueReposQueryPattern.MatchString(reposQuery) { + // remove "[" and "]" from string + reposQuery = reposQuery[1 : len(reposQuery)-1] + //for each ID (delimiter ",") add to int to repoIDs + for _, rID := range strings.Split(reposQuery, ",") { + // Ensure nonempty string entries + if rID != "" && rID != "0" { + rIDint64, err := strconv.ParseInt(rID, 10, 64) + if err == nil { + repoIDs = append(repoIDs, rIDint64) + } } } + } else { + log.Error("issueReposQueryPattern not match with query") } - } else { - log.Error("issueReposQueryPattern not match with query") } isShowClosed := ctx.Query("state") == "closed" From e031e7130c0290a249ac4eef40c60097c69f95a5 Mon Sep 17 00:00:00 2001 From: guillep2k <18600385+guillep2k@users.noreply.github.com> Date: Thu, 2 Jan 2020 16:34:45 -0300 Subject: [PATCH 2/2] Update routers/user/home.go Co-Authored-By: Lauris BH --- routers/user/home.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/user/home.go b/routers/user/home.go index e38196694d61a..f5e74b240664e 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -389,7 +389,7 @@ func Issues(ctx *context.Context) { reposQuery := ctx.Query("repos") var repoIDs []int64 - if(reposQuery != "") { + if len(reposQuery) != 0 { if issueReposQueryPattern.MatchString(reposQuery) { // remove "[" and "]" from string reposQuery = reposQuery[1 : len(reposQuery)-1]