lib/dynamic_image/railtie.rb in dynamic_image-2.0.9 vs lib/dynamic_image/railtie.rb in dynamic_image-2.0.10
- old
+ new
@@ -3,9 +3,20 @@
module DynamicImage
class Railtie < ::Rails::Railtie
initializer "dynamic_image" do
ActionDispatch::Routing::Mapper.send :include, DynamicImage::Routing
+ ActionDispatch::ExceptionWrapper.rescue_responses.merge!(
+ "DynamicImage::Errors::InvalidSignature" => :unauthorized
+ )
+
+ # If Sentry is configured, exclude reporting of tampered signatures
+ if Object.const_defined?("Raven")
+ Raven.configure do |c|
+ c.excluded_exceptions += ["DynamicImage::Errors::InvalidSignature"]
+ end
+ end
+
config.after_initialize do |app|
secret = app.key_generator.generate_key("dynamic_image")
DynamicImage.digest_verifier = DynamicImage::DigestVerifier.new(secret)
end