mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Crazy large ids should not raise exceptions
This commit is contained in:
@ -100,7 +100,16 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
class PluginDisabled < StandardError; end
|
||||
|
||||
rescue_from Discourse::NotFound, PluginDisabled do
|
||||
# Handles requests for giant IDs that throw pg exceptions
|
||||
rescue_from RangeError do |e|
|
||||
if e.message =~ /ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer/
|
||||
rescue_discourse_actions(:not_found, 404)
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
rescue_from Discourse::NotFound, PluginDisabled do
|
||||
rescue_discourse_actions(:not_found, 404)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user