Fixed a nil reference error in sanitize_filename
This commit is contained in:
Родитель
6b7bc91a42
Коммит
61ad36fb73
|
@ -371,6 +371,7 @@ module Technoweenie # :nodoc:
|
|||
end
|
||||
|
||||
def sanitize_filename(filename)
|
||||
return unless filename
|
||||
returning filename.strip do |name|
|
||||
# NOTE: File.basename doesn't work right with Windows paths on Unix
|
||||
# get only the filename, not the whole path
|
||||
|
|
|
@ -42,6 +42,9 @@ class BasicTest < Test::Unit::TestCase
|
|||
|
||||
@attachment.filename = 'f o!O-.bar'
|
||||
assert_equal 'f_o_O-.bar', @attachment.filename
|
||||
|
||||
@attachment.filename = nil
|
||||
assert_nil @attachment.filename
|
||||
end
|
||||
|
||||
def test_should_convert_thumbnail_name
|
||||
|
|
Загрузка…
Ссылка в новой задаче