Skip to content

Commit

Permalink
return 404 on invalid user
Browse files Browse the repository at this point in the history
  • Loading branch information
noerw committed Dec 21, 2020
1 parent 717f2ab commit a75ed37
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions routers/api/v1/repo/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ func ListTrackedTimes(ctx *context.APIContext) {
qUser := strings.Trim(ctx.Query("user"), " ")
if qUser != "" {
user, err := models.GetUserByName(qUser)
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.Error(http.StatusNotFound, "User does not exist", err)
} else if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserByName", err)
return
}
Expand Down Expand Up @@ -500,7 +502,9 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
qUser := strings.Trim(ctx.Query("user"), " ")
if qUser != "" {
user, err := models.GetUserByName(qUser)
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.Error(http.StatusNotFound, "User does not exist", err)
} else if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserByName", err)
return
}
Expand Down

0 comments on commit a75ed37

Please sign in to comment.