You'll notice that in the pure Rack environment, attachment-1 is a hash. In Rails, it's an ActionDispatch::Http::UploadedFile object. Your code assumes you are passing a ActionDispatch::Http::UploadedFile object to the Mailgun receiver.
I just ran into this in my own project MultiMail. I handle both cases now by checking if attachment-1 is a hash.
Notably, they handle attachments differently. I set up two servers for Mailgun to POST to. Here are the results:
You'll notice that in the pure Rack environment,
attachment-1
is a hash. In Rails, it's anActionDispatch::Http::UploadedFile
object. Your code assumes you are passing aActionDispatch::Http::UploadedFile
object to the Mailgun receiver.I just ran into this in my own project MultiMail. I handle both cases now by checking if
attachment-1
is a hash.