Missing method 'content_type' for Amazon S3 uploads


(Sander Datema) #1

I don’t know when this stopped working, but on my (Docker) install I get this error in the log: undefined method 'content_type'

[RAILS_ROOT]/vendor/bundle/ruby/2.0.0/bin/unicorn:23:in `&lt;main&gt;'</backtrace>
  <message>undefined method `content_type' for #&lt;Tempfile:/tmp/RackMultipart20140415-15217-45vwta&gt;</message>
  <url>http://domain.ext/uploads</url>
  <exception-class>NoMethodError</exception-class>
</hash>
<hash>
  <date type="dateTime">2014-04-15T10:30:24+00:00</date>
  <guid>1d7786b3-9279-488e-afa8-5217bfe67fdb</guid>
  <user-id type="integer">2</user-id>
  <parameters>{"files":[{"tempfile":["�PNG\r\n","\u001A\n","\u0000\u0000\u0000\rIHDR\u0000\u0000\u0001t\u0000\u0000\u0001�\b\u0002\u0000\u0000\u0000\u000B�m�\u0000\u0000\u0000\tpHYs
  <action>create</action>
  <controller>uploads</controller>
  <backtrace>[RAILS_ROOT]/lib/file_store/s3_store.rb:10:in `store_upload'
[RAILS_ROOT]/app/models/upload.rb:96:in `create_for'

(Régis Hanol) #2

Sorry :sweat: I just fixed it…

https://github.com/discourse/discourse/commit/542d54e6bfef6672ff732d3d5d4661fac53a5064


(Jeff Atwood) #3