diff --git a/app/helpers/file_type_helper.rb b/app/helpers/file_type_helper.rb index 03b807aad..6bae0d3d1 100644 --- a/app/helpers/file_type_helper.rb +++ b/app/helpers/file_type_helper.rb @@ -17,6 +17,7 @@ module FileTypeHelper def image_file?(content_type) [ 'image/jpeg', + 'image/jpg', 'image/png', 'image/gif', 'image/bmp', diff --git a/app/mailboxes/mailbox_helper.rb b/app/mailboxes/mailbox_helper.rb index f7a44ccca..edabfd4ce 100644 --- a/app/mailboxes/mailbox_helper.rb +++ b/app/mailboxes/mailbox_helper.rb @@ -1,5 +1,6 @@ module MailboxHelper include MailboxInlineAttachmentHelper + include ::FileTypeHelper private @@ -53,11 +54,12 @@ module MailboxHelper def process_regular_attachments(attachments) Rails.logger.info "[MailboxHelper] Processing regular attachments for message with ID: #{processed_mail.message_id}" attachments.each do |mail_attachment| + blob = mail_attachment[:blob] attachment = @message.attachments.new( account_id: @conversation.account_id, - file_type: 'file' + file_type: file_type(blob.content_type) ) - attachment.file.attach(mail_attachment[:blob]) + attachment.file.attach(blob) end end