@@ -87,7 +87,7 module Redmine | |||||
87 | a = Attachment.find_by_token(token) |
|
87 | a = Attachment.find_by_token(token) | |
88 | next unless a |
|
88 | next unless a | |
89 | a.filename = attachment['filename'] unless attachment['filename'].blank? |
|
89 | a.filename = attachment['filename'] unless attachment['filename'].blank? | |
90 | a.content_type = attachment['content_type'] |
|
90 | a.content_type = attachment['content_type'] unless attachment['content_type'].blank? | |
91 | end |
|
91 | end | |
92 | next unless a |
|
92 | next unless a | |
93 | a.description = attachment['description'].to_s.strip |
|
93 | a.description = attachment['description'].to_s.strip |
@@ -241,6 +241,15 class AttachmentTest < ActiveSupport::TestCase | |||||
241 | end |
|
241 | end | |
242 | end |
|
242 | end | |
243 |
|
243 | |||
|
244 | test "Attachment.attach_files should preserve the content_type of attachments added by token" do | |||
|
245 | @project = Project.find(1) | |||
|
246 | attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", ""), :author_id => 1, :created_on => 2.days.ago) | |||
|
247 | assert_equal 'text/plain', attachment.content_type | |||
|
248 | Attachment.attach_files(@project, { '1' => {'token' => attachment.token } }) | |||
|
249 | attachment.reload | |||
|
250 | assert_equal 'text/plain', attachment.content_type | |||
|
251 | end | |||
|
252 | ||||
244 | def test_latest_attach |
|
253 | def test_latest_attach | |
245 | set_fixtures_attachments_directory |
|
254 | set_fixtures_attachments_directory | |
246 | a1 = Attachment.find(16) |
|
255 | a1 = Attachment.find(16) |
General Comments 0
You need to be logged in to leave comments.
Login now