Module: Ungarbled::ActionControllerExt

Extended by:
ActiveSupport::Concern
Defined in:
lib/ungarbled/action_controller_ext.rb

Constant Summary collapse

SEND_FILE_HEADERS_PROC =
lambda do |options|
  if !::Rails.configuration.ungarbled.disable_auto_encode &&
     options[:filename]
    options[:filename] = encode_filename(options[:filename])
  end

  if defined?(send_file_headers_without_encode_filename!)
    send_file_headers_without_encode_filename!(options)
  else
    super
  end
end

Class Method Summary collapse

Class Method Details

.prepended(mod) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/ungarbled/action_controller_ext.rb', line 29

def self.prepended(mod)
  class << mod
    define_method :send_file_headers!, &SEND_FILE_HEADERS_PROC
  end
  mod.helper_method :encode_filename
  mod.helper_method :encode_filename_for_zip_item
end