post queries: raise error on invalid searches.
Raise an error if the search is invalid for one of the following reasons: * It contains multiple conflicting order: metatags (e.g. `order:score order:favcount` or `ordfav:a ordfav:b`). * It contains a metatag that can't be used more than once: (e.g. `limit:5 limit:10`, `random:5 random:10`). * It contains a metatag that can't be negated (e.g. `-order:score`, `-limit:20`, or `-random:20`). * It contains a metatag that can't be used in an OR clause (e.g. ` touhou or order:score`, `touhou or limit:20`, `touhou or random:20`).
This commit is contained in:
@@ -130,7 +130,7 @@ class ApplicationController < ActionController::Base
|
||||
render_error_page(406, exception, message: "#{request.format} is not a supported format for this page")
|
||||
when PaginationExtension::PaginationError
|
||||
render_error_page(410, exception, template: "static/pagination_error", message: "You cannot go beyond page #{CurrentUser.user.page_limit}.")
|
||||
when PostQueryBuilder::TagLimitError
|
||||
when PostQuery::TagLimitError
|
||||
render_error_page(422, exception, template: "static/tag_limit_error", message: "You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time.")
|
||||
when RateLimiter::RateLimitError
|
||||
render_error_page(429, exception, message: "Rate limit exceeded. You're doing that too fast")
|
||||
|
||||
Reference in New Issue
Block a user