all repos — searchix @ d39204eadf673b6c7ae940203fd75c0805245a96

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: don't attempt to load more than configured number of results

Alan Pearce
commit

d39204eadf673b6c7ae940203fd75c0805245a96

parent

a4d9d94174da12cf86d0d914f1c02e3b1be73fe1

1 file changed, 3 insertions(+), 2 deletions(-)

jump to
M internal/server/mux.gointernal/server/mux.go
@@ -107,7 +107,7 @@ return
} if pageNumber == 0 { pageNumber = 1 - pageSize = math.MaxInt + pageSize = config.MaxResultsShowAll } } page := pagination.New(pageNumber, pageSize)
@@ -127,7 +127,8 @@ errorHandler(w, r, err.Error(), http.StatusInternalServerError)
return } - if pageSize == math.MaxInt && results.Total > config.MaxResultsShowAll { + if pageSize == config.MaxResultsShowAll && + results.Total > config.MaxResultsShowAll { errorHandler(w, r, "Too many results, use pagination", http.StatusBadRequest) }