Skip to content

Commit

Permalink
Fix error logged when repos qs is empty (#9591)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Jan 3, 2020
1 parent 4a768e1 commit bedd7b2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions routers/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bedd7b2

Please sign in to comment.