Browse files

Fixed a nil reference error in sanitize_filename

  • Loading branch information...
1 parent 6b7bc91 commit 61ad36fb73de927ace41689999187076496934df @nbibler nbibler committed May 16, 2008
Showing with 4 additions and 0 deletions.
  1. +1 −0 lib/technoweenie/attachment_fu.rb
  2. +3 −0 test/basic_test.rb
View
1 lib/technoweenie/attachment_fu.rb
@@ -371,6 +371,7 @@ def random_tempfile_filename
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
View
3 test/basic_test.rb
@@ -42,6 +42,9 @@ def test_should_sanitize_filenames
@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

0 comments on commit 61ad36f

Please sign in to comment.