Project

General

Profile

Actions

Defect #35715

closed

File upload fails when run with uWSGI

Added by Cyprien D over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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

35715.patch (1.09 KB) 35715.patch Patch by Pavel Rosický and Holger Just Go MAEDA, 2021-08-12 06:40
35715-v2.patch (2.44 KB) 35715-v2.patch Go MAEDA, 2021-08-13 02:55

Related issues

Related to Redmine - Defect #33752: Uploading a big file fails with NoMemoryErrorClosedGo MAEDA

Actions
Actions

Also available in: Atom PDF