Commit 311732b3 by Jon Yurek

Changed the sanitization a little.

parent e0c9d64f
......@@ -58,7 +58,7 @@ module Paperclip
return nil if uploaded_file.nil?
@queued_for_write[:original] = uploaded_file.to_tempfile
@instance[:"#{@name}_file_name"] = uploaded_file.original_filename.strip.gsub /[^A-Za-z0-9\.]/, '_'
@instance[:"#{@name}_file_name"] = uploaded_file.original_filename.strip.gsub /[^\w\d\.\-]+/, '_'
@instance[:"#{@name}_content_type"] = uploaded_file.content_type.strip
@instance[:"#{@name}_file_size"] = uploaded_file.size.to_i
......
......@@ -137,7 +137,7 @@ class AttachmentTest < Test::Unit::TestCase
end
should "remove strange letters and replace with underscore (_)" do
assert_equal "sheep_say_b__.png", @dummy.avatar.original_filename
assert_equal "sheep_say_b_.png", @dummy.avatar.original_filename
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment