Skip to content

Commit

Permalink
fix(backend): validate limit to not be zero
Browse files Browse the repository at this point in the history
- validate limit to ensure it is never zero

fixes #1498

Signed-off-by: detj <[email protected]>
  • Loading branch information
detj committed Nov 7, 2024
1 parent c7245b0 commit e983d97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/api/filter/appfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"slices"
"time"
Expand Down Expand Up @@ -200,6 +201,10 @@ func (af *AppFilter) Validate() error {
return fmt.Errorf("`from` cannot be later than now")
}

if af.Limit == 0 {
return errors.New("`limit` cannot be zero")
}

if af.Limit > MaxPaginationLimit {
return fmt.Errorf("`limit` cannot be more than %d", MaxPaginationLimit)
}
Expand Down

0 comments on commit e983d97

Please sign in to comment.