From 6369d139dd1697a582daf102bdc7edc0101718b4 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 11 May 2021 05:35:19 +0000 Subject: Uploading a big file fails with NoMemoryError (#33752). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Karel Pičman and Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@20993 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/api_test/attachments_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/integration/api_test') diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index 545dd81f2..538649950 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -250,4 +250,26 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base assert attachment.digest.present? assert File.exist? attachment.diskfile end + + test "POST /uploads.json should be compatible with an fcgi's input" do + set_tmp_attachments_directory + assert_difference 'Attachment.count' do + post( + '/uploads.json', + :headers => { + "CONTENT_TYPE" => 'application/octet-stream', + "CONTENT_LENGTH" => '12', + "rack.input" => Rack::RewindableInput.new(StringIO.new('File content')) + }.merge(credentials('jsmith')) + ) + assert_response :created + end + json = ActiveSupport::JSON.decode(response.body) + assert_kind_of Hash, json['upload'] + token = json['upload']['token'] + assert token.present? + assert attachment = Attachment.find_by_token(token) + assert_equal 12, attachment.filesize + assert File.exist? attachment.diskfile + end end -- cgit v1.2.3