Actions
Defect #35715
closedFile upload fails when run with uWSGI
Defect #35715:
File upload fails when run with uWSGI
Resolution:
Fixed
Affected version:
Description
Hello,
Attachments are broken since I have upgrade my Redmine from 4.2.1 to 4.2.2.
POST fail with a 500 error and this error is logged:
Started POST "/uploads.js?attachment_id=2&filename=placeholder.jpeg&content_type=image%2Fjpeg" for X.X.X.X at 2021-08-05 17:48:28 +0200
Processing by AttachmentsController#upload as JS
Parameters: {"attachment_id"=>"2", "filename"=>"placeholder.jpeg", "content_type"=>"image/jpeg"}
Current user: cyprien (id=121)
Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.9ms)
NoMethodError (undefined method `size' for #<Uwsgi_IO:0x00005566ba40c8d0>):
app/models/attachment.rb:123:in `file='
app/controllers/attachments_controller.rb:108:in `upload'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'
It seems to come from this change introduced to 4.2.2
diff redmine-4.2.1/app/controllers/attachments_controller.rb redmine-4.2.2/app/controllers/attachments_controller.rb 108c108 < @attachment = Attachment.new(:file => request.raw_post) --- > @attachment = Attachment.new(:file => request.body)
If I switch back from request.body to request.raw_post the error is fixed
Files
Actions