Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed the sanitization a little.

  • Loading branch information...
commit 311732b3b4f8ab4985506e7e2c03af7d57893ff2 1 parent e0c9d64
@jyurek jyurek authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/paperclip/attachment.rb
  2. +1 −1  test/test_attachment.rb
View
2  lib/paperclip/attachment.rb
@@ -58,7 +58,7 @@ def assign uploaded_file
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
View
2  test/test_attachment.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.