diff options
author | Unknwon <u@gogs.io> | 2017-06-27 20:21:36 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-06-27 20:21:36 -0400 |
commit | 8ed2330d6e9be743b208bca4cd5a25269318040a (patch) | |
tree | e2126e5ab9e92894cdb1d627167f25193679fd93 /routes | |
parent | 261237745f3786dc1ca0aea85dde101bd2870be3 (diff) |
issue_comment: fix pg syntax ambiguous (#4586)
Also handle error related to time parsing.
Diffstat (limited to 'routes')
-rw-r--r-- | routes/api/v1/repo/issue_comment.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/routes/api/v1/repo/issue_comment.go b/routes/api/v1/repo/issue_comment.go index 4a057d76..161ddf05 100644 --- a/routes/api/v1/repo/issue_comment.go +++ b/routes/api/v1/repo/issue_comment.go @@ -15,7 +15,12 @@ import ( func ListIssueComments(c *context.APIContext) { var since time.Time if len(c.Query("since")) > 0 { - since, _ = time.Parse(time.RFC3339, c.Query("since")) + var err error + since, err = time.Parse(time.RFC3339, c.Query("since")) + if err != nil { + c.Error(422, "", err) + return + } } // comments,err:=models.GetCommentsByIssueIDSince(, since) @@ -41,7 +46,12 @@ func ListIssueComments(c *context.APIContext) { func ListRepoIssueComments(c *context.APIContext) { var since time.Time if len(c.Query("since")) > 0 { - since, _ = time.Parse(time.RFC3339, c.Query("since")) + var err error + since, err = time.Parse(time.RFC3339, c.Query("since")) + if err != nil { + c.Error(422, "", err) + return + } } comments, err := models.GetCommentsByRepoIDSince(c.Repo.Repository.ID, since.Unix()) |