summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-04-16 01:45:15 +0000
committerGo MAEDA <maeda@farend.jp>2021-04-16 01:45:15 +0000
commitd22c389ba23f6e906fdd98867cf2d555e4ea2ba5 (patch)
tree2aca77226b3033768eba0109112e845a63f26afe /test/unit
parent4261c16574a9dbe6e4be81dbd8a8f311eb7f9769 (diff)
downloadredmine-d22c389ba23f6e906fdd98867cf2d555e4ea2ba5.tar.gz
redmine-d22c389ba23f6e906fdd98867cf2d555e4ea2ba5.zip
Merged r20946 from trunk to 4.1-stable (#34367).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@20948 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/attachment_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb
index e2b6bb85e..3c1500d70 100644
--- a/test/unit/attachment_test.rb
+++ b/test/unit/attachment_test.rb
@@ -152,6 +152,19 @@ class AttachmentTest < ActiveSupport::TestCase
end
end
+ def test_extension_update_should_be_validated_against_denied_extensions
+ with_settings :attachment_extensions_denied => "txt, png" do
+ a = Attachment.new(:container => Issue.find(1),
+ :file => mock_file_with_options(:original_filename => "test.jpeg"),
+ :author => User.find(1))
+ assert_save a
+
+ b = Attachment.find(a.id)
+ b.filename = "test.png"
+ assert !b.save
+ end
+ end
+
def test_valid_extension_should_be_case_insensitive
with_settings :attachment_extensions_allowed => "txt, Png" do
assert Attachment.valid_extension?(".pnG")