Override how the content_type gets set on ActionDispatch::Http::UploadedFile?


I have extension-less DICOM files that I need to determine the proper MIME type on when uploaded.

file --b --mime-type MyFile


reports the files as application/dicom so I know they are valid but when uploaded through Rails they get the type ‘applcation/octet-stream’. Is there an easy way to change this behaviour preferably without monkey patching? Could this be done through Rack middleware to provide a general solution?

I am running version 5.2.0.beta2 on Ruby 2.5.0


What is doing the "uploading"? If it's through a browser/form, I'd
imagine the browser is setting the Content-Type header.