プロジェクト

全般

プロフィール

Vote #71771

完了

REST Uploads fail with fastcgi

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
48
issue_org_id:
10832
author_id:
35207
assigned_to_id:
1
comments:
8
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
46
ステータス-->[Closed]

説明

Unable to upload attachments through REST API.

@curl --data-binary "@README" -H "Content-Type: application/octet-stream" -X POST -u admin:test http://localhost/uploads.xml@

Processing AttachmentsController#upload to xml (for 127.0.0.1 at 2012-05-04 11:52:53) [POST]
  Parameters: {"action"=>"upload", "controller"=>"attachments", "format"=>"xml"}

NoMethodError (undefined method `size' for #):
  app/models/attachment.rb:78:in `file='
  app/controllers/attachments_controller.rb:70:in `new'
  app/controllers/attachments_controller.rb:70:in `upload'
  dispatch.fcgi:27

Rendering rescues/layout (internal_server_error)

journals

Webrick appears to work fine. Perhaps a problem related to fastcgi.
--------------------------------------------------------------------------------
I'm able to reproduce with apache+fastcgi.
--------------------------------------------------------------------------------
Unfortunately the various Rack::Handler's don't handle input all the same way :(
--------------------------------------------------------------------------------
Or maybe (untested):

<pre>
Index: app/controllers/attachments_controller.rb
===================================================================
--- app/controllers/attachments_controller.rb (revision 9616)
+++ app/controllers/attachments_controller.rb (working copy)
@@ -67,7 +67,7 @@
return
end

- @attachment = Attachment.new(:file => request.body)
+ @attachment = Attachment.new(:file => request.raw_post)
@attachment.author = User.current
@attachment.filename = Redmine::Utils.random_hex(16)

</pre>

--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> Or maybe (untested):

Nope :(

<pre>
NoMethodError (undefined method `read' for #<String:0x7f191b1fbae0>):
app/models/attachment.rb:114:in `files_to_final_location'
app/models/attachment.rb:112:in `open'
app/models/attachment.rb:112:in `files_to_final_location'
app/controllers/attachments_controller.rb:74:in `upload'
dispatch.fcgi:27
</pre>
--------------------------------------------------------------------------------
Jeffrey Clark wrote:
> Nope :(

The patch should work after r9630.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Fixed in 1.4-stable (r9653) and trunk (r9652). Tested with apache2+fcgid.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリREST API_32 にセット
  • 対象バージョン1.4.2_48 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0