Module: Card::Set::Type::File::FileFormat

Extended by:
AbstractFormat
Included in:
Image::FileFormat
Defined in:
tmpsets/set/mod019-carrierwave/type/file.rb

Instance Method Summary collapse

Instance Method Details

#args_for_send_fileObject



66
67
68
69
70
71
72
# File 'tmpsets/set/mod019-carrierwave/type/file.rb', line 66

def args_for_send_file
  file = selected_version
  [file.path, { type: file.content_type,
                filename:  "#{card.name.safe_key}#{file.extension}",
                x_sendfile: true,
                disposition: (params[:format] == "file" ? "attachment" : "inline") }]
end

#set_response_headersObject



74
75
76
77
78
79
80
# File 'tmpsets/set/mod019-carrierwave/type/file.rb', line 74

def set_response_headers
  return unless params[:explicit_file] && (response = controller&.response)
  response.headers["Expires"] = 1.year.from_now.httpdate
  # currently using default "private", because proxy servers could block
  # needed permission checks
  # r.headers["Cache-Control"] = "public"
end