]> source.dussan.org Git - redmine.git/commitdiff
add test of upload filename with plus (#11568)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 19 May 2020 08:23:03 +0000 (08:23 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 19 May 2020 08:23:03 +0000 (08:23 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19786 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/attachments_test.rb

index d123c9ef1e22cc2f92e609056361d1b306655636..49b99421f4238e47a0478ca1194fb2e30fca2d98 100644 (file)
@@ -130,6 +130,30 @@ class AttachmentsTest < Redmine::IntegrationTest
     assert_equal 'File content'.length, attachment.filesize
   end
 
+  def test_upload_filename_with_plus
+    log_user('jsmith', 'jsmith')
+    filename = 'a+b.txt'
+    token = ajax_upload(filename, 'File content')
+    assert_difference 'Issue.count' do
+      post(
+        '/projects/ecookbook/issues',
+        :params => {
+          :issue => {:tracker_id => 1, :subject => 'Issue with upload'},
+          :attachments => {'p0' => {:filename => filename, :token => token}}
+        }
+      )
+      assert_response 302
+    end
+    issue = Issue.order('id DESC').first
+    assert_equal 'Issue with upload', issue.subject
+    assert_equal 1, issue.attachments.count
+
+    attachment = issue.attachments.first
+    assert_equal filename, attachment.filename
+    assert_equal '', attachment.description
+    assert_equal 'File content'.length, attachment.filesize
+  end
+
   def test_upload_as_js_and_destroy
     log_user('jsmith', 'jsmith')