summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-01-03 18:39:12 -0300
committerLauris BH <lauris@nix.lv>2020-01-03 23:39:12 +0200
commitbedd7b2833349c151eeb21bec90d5cec0453613a (patch)
tree598e5d73e7b3040c83a222c31765e02d5f69f5b1 /routers/user
parent4a768e1c3e34fb3129e9a1c83cf16b758bfa5ae5 (diff)
downloadgitea-bedd7b2833349c151eeb21bec90d5cec0453613a.tar.gz
gitea-bedd7b2833349c151eeb21bec90d5cec0453613a.zip
Fix error logged when repos qs is empty (#9591)
* Fix error logged when repos qs is empty * Update routers/user/home.go Co-Authored-By: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/home.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/routers/user/home.go b/routers/user/home.go
index ae5975a711..f5e74b2406 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 len(reposQuery) != 0 {
+ 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"