Sha256: 1b48e174a98e51a4c5f9ad60f7af08dda94571a9c78020ecf542cde7e1b2df5b
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# Rails 3.2.16 and 4.0.2 introduced a fix for CVE-2013-4491 : # https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a # # This fix introduces a :raise option to the :translate helper, which # defines wether an exception shall be raised (:raise => true) or delegated # to I18n.exception_handler (:raise => false). # # This monkey patch forces :raise to `false`, to force use of Localeapp::ExceptionHandler # # NB: the CVE-2013-4491 fix also introduced a regression which is fixed in: # https://github.com/rails/rails/commit/31a485fa5a843a766c4b889ee88a6c590a3a6ebb module Localeapp module ForceExceptionHandlerInTranslationHelper def translate(key, options = {}) if [options[:scope], key].compact.join(".").match?(Localeapp.configuration.blacklisted_keys_pattern) super(key, options) else super(key, {:raise => false}.merge(options)) end end alias :t :translate end end ActionView::Base.send(:include, ::Localeapp::ForceExceptionHandlerInTranslationHelper)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
localeapp-2.5.0 | lib/localeapp/rails/force_exception_handler_in_translation_helper.rb |