diff --git a/http/task_service.go b/http/task_service.go index 1e2f5b8d3f..75d40a3636 100644 --- a/http/task_service.go +++ b/http/task_service.go @@ -560,17 +560,17 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or req.filter.Limit = i } + var at, bt string var afterTime, beforeTime time.Time - if at := qp.Get("afterTime"); at != "" { + if at = qp.Get("afterTime"); at != "" { afterTime, err = time.Parse(time.RFC3339, at) if err != nil { return nil, err } req.filter.AfterTime = at - } - if bt := qp.Get("beforeTime"); bt != "" { + if bt = qp.Get("beforeTime"); bt != "" { beforeTime, err = time.Parse(time.RFC3339, bt) if err != nil { return nil, err @@ -578,7 +578,7 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or req.filter.BeforeTime = bt } - if &afterTime != nil && &beforeTime != nil && afterTime.Sub(beforeTime).Nanoseconds() > 0 { + if at != "" && bt != "" && afterTime.Sub(beforeTime).Nanoseconds() > 0 { return nil, kerrors.InvalidDataf("beforeTime must be greater than afterTime") }