From a3570ff62b795ee4e68322f7888269d45acec9b1 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 2 Jul 2018 03:03:12 +0000 Subject: [PATCH] Merged r17428 from trunk to 3.4-stable (#29038). git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17429 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/attachment.rb | 2 +- test/unit/attachment_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index eea80132c..64ac2c2d1 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -156,7 +156,7 @@ class Attachment < ActiveRecord::Base end def title - title = filename.to_s + title = filename.dup if description.present? title << " (#{description})" end diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index e55c60b86..4093df75d 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -262,6 +262,7 @@ class AttachmentTest < ActiveSupport::TestCase a = Attachment.new(:filename => "test.png", :description => "Cool image") assert_equal "test.png (Cool image)", a.title + assert_equal "test.png", a.filename end def test_new_attachment_should_be_editable_by_author