Return 400 error if limit_after is zero (#15049)

Этот коммит содержится в:
Claudio Costa
2020-07-20 10:08:52 +02:00
коммит произвёл GitHub
родитель aae3b9650f
Коммит 484e813dca
4 изменённых файлов: 30 добавлений и 1 удалений

Просмотреть файл

@@ -691,6 +691,11 @@ func (s *SqlPostStore) GetPostsAfter(options model.GetPostsOptions) (*model.Post
}
func (s *SqlPostStore) getPostsAround(before bool, options model.GetPostsOptions) (*model.PostList, *model.AppError) {
if options.Page < 0 || options.PerPage < 0 {
return nil, model.NewAppError("SqlPostStore.GetPostContext", "store.sql_post.get_posts_around.get.app_error", nil,
fmt.Sprintf("Page=%d and PerPage=%d must be non-negative", options.Page, options.PerPage), http.StatusBadRequest)
}
offset := options.Page * options.PerPage
var posts, parents []*model.Post