public
Description: Paperclip File Management Plugin
Homepage: http://www.thoughtbot.com/projects/paperclip
Clone URL: git://github.com/thoughtbot/paperclip.git
Changed the sanitization a little.
jyurek (author)
Mon Jun 09 11:21:01 -0700 2008
commit  311732b3b4f8ab4985506e7e2c03af7d57893ff2
tree    17522c29273e6005e91ddeba811f3841937dd7fe
parent  e0c9d64f431c147b87b4762e2bce4019692ce7ea
...
58
59
60
61
 
62
63
64
...
58
59
60
 
61
62
63
64
0
@@ -58,7 +58,7 @@ module Paperclip
0
       return nil if uploaded_file.nil?
0
 
0
       @queued_for_write[:original] = uploaded_file.to_tempfile
0
- @instance[:"#{@name}_file_name"] = uploaded_file.original_filename.strip.gsub /[^A-Za-z0-9\.]/, '_'
0
+ @instance[:"#{@name}_file_name"] = uploaded_file.original_filename.strip.gsub /[^\w\d\.\-]+/, '_'
0
       @instance[:"#{@name}_content_type"] = uploaded_file.content_type.strip
0
       @instance[:"#{@name}_file_size"] = uploaded_file.size.to_i
0
 
...
137
138
139
140
 
141
142
143
...
137
138
139
 
140
141
142
143
0
@@ -137,7 +137,7 @@ class AttachmentTest < Test::Unit::TestCase
0
     end
0
     
0
     should "remove strange letters and replace with underscore (_)" do
0
- assert_equal "sheep_say_b__.png", @dummy.avatar.original_filename
0
+ assert_equal "sheep_say_b_.png", @dummy.avatar.original_filename
0
     end
0
     
0
   end

Comments

    No one has commented yet.