Class: MailDude::AttachmentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mail_dude/attachments_controller.rb

Constant Summary collapse

SAFE_INLINE_TYPES =
%w[image/gif image/jpeg image/png image/webp image/svg+xml].freeze

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
# File 'app/controllers/mail_dude/attachments_controller.rb', line 7

def show
  record = MailDude.store.find(params[:message_id] || params[:id])
  attachment = AttachmentLocator.new(record).find(params[:attachment_id])
  send_data attachment.data,
            filename: attachment.filename,
            type: attachment.content_type,
            disposition: disposition_for(attachment)
end