Check negative limit command parameter (#358) (#359)

fix #358

Co-authored-by: Brahim Hamdouni <brahim@hamdouni.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/359
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Co-authored-by: Brahim HAMDOUNI <hamdouni@noreply.gitea.io>
Co-committed-by: Brahim HAMDOUNI <hamdouni@noreply.gitea.io>
This commit is contained in:
Brahim HAMDOUNI 2021-05-15 22:16:24 +08:00 committed by 6543
parent 568fde1ce5
commit ffdbdb3d02

View File

@ -39,6 +39,9 @@ type TeaContext struct {
func (ctx *TeaContext) GetListOptions() gitea.ListOptions { func (ctx *TeaContext) GetListOptions() gitea.ListOptions {
page := ctx.Int("page") page := ctx.Int("page")
limit := ctx.Int("limit") limit := ctx.Int("limit")
if limit < 0 {
limit = 0
}
if limit != 0 && page == 0 { if limit != 0 && page == 0 {
page = 1 page = 1
} }