diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index e47f95f37cf..938e13bc654 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -335,8 +335,8 @@ func ListIssues(ctx *context.APIContext) { keyword := ctx.FormTrim("q") var labelIDs []int64 - if splitted := strings.Split(ctx.FormString("labels"), ","); len(splitted) > 0 { - labelIDs, err = issues_model.GetLabelIDsInRepoByNames(ctx, ctx.Repo.Repository.ID, splitted) + if labelsParam := ctx.FormTrim("labels"); labelsParam != "" { + labelIDs, err = issues_model.GetLabelIDsInRepoByNames(ctx, ctx.Repo.Repository.ID, strings.Split(labelsParam, ",")) if err != nil { ctx.APIErrorInternal(err) return