Fix blank error page when performing search with invalid regex.
Fix searches like this:
https://danbooru.donmai.us/artist_urls?search[url_not_regex]=https://www/.artstation/.com/[a-zA-Z0-9-.]
returning a HTTP 500 error with a blank page.
Here the problem is that Postgres raises an error because `[a-zA-Z0-9-.]`
is an invalid character class (it should be `[a-ZA-Z0-9.-]`). This error
happens on the error page itself, when rendering the <link rel="next"> /
<link rel="prev"> links in the <head>, so it causes the error page to fail.
This commit is contained in:
@@ -86,6 +86,8 @@ module ComponentsHelper
|
||||
# The <link rel="next"> / <link rel="prev"> links in the <meta> element of the <head>.
|
||||
def render_meta_links(records)
|
||||
render PaginatorComponent.new(records: records, params: params).with_variant(:meta_links)
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
# Swallow any exceptions when loading records so that the page load doesn't fail.
|
||||
end
|
||||
|
||||
def numbered_paginator(records)
|
||||
|
||||
Reference in New Issue
Block a user