Strip eols from file names (#14819).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12128 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-09-11 19:19:24 +00:00
parent 06efcaddfa
commit 02fca76c13
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -42,6 +42,13 @@ class AttachmentTest < ActiveSupport::TestCase
assert_nil Attachment.new.container
end
def test_filename_should_remove_eols
assert_equal "line_feed", Attachment.new(:filename => "line\nfeed").filename
assert_equal "line_feed", Attachment.new(:filename => "some\npath/line\nfeed").filename
assert_equal "carriage_return", Attachment.new(:filename => "carriage\rreturn").filename
assert_equal "carriage_return", Attachment.new(:filename => "some\rpath/carriage\rreturn").filename
end
def test_create
a = Attachment.new(:container => Issue.find(1),
:file => uploaded_test_file("testfile.txt", "text/plain"),