We're seeing an issue where a TempFile used with an ActionDispatch::Http::UploadedFile is resulting in the filename= of the multipart body using the randomly generated filename of the Tempfile instead of the original_filename.
For example:
filename = 'test.txt'
tempfile = Tempfile.open(filename) # creates /var/folders/sm/f8vxq1813p3913nwj9_qh7xs6js3gp/T/test.txt20180702-40300-7o0g19
upload = ActionDispatch::Http::UploadedFile.new(tempfile: tempfile, filename: filename)
upload.original_filename # => "test.txt" desired result
File.basename(upload.path) # => "test.txt20180702-40300-dyj4fd" actual result
Hello!
We're seeing an issue where a TempFile used with an ActionDispatch::Http::UploadedFile is resulting in the
filename=
of the multipart body using the randomly generated filename of theTempfile
instead of theoriginal_filename
.For example:
Apparent root cause: https://github.com/jnunemaker/httparty/blob/master/lib/httparty/request/body.rb#L37