Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a nil reference error in sanitize_filename

  • Loading branch information...
commit 61ad36fb73de927ace41689999187076496934df 1 parent 6b7bc91
@nbibler nbibler authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.