Commit aff3396e by Jon Yurek

Removed extra filename parsing in metadata cleaner. If it hadn't been done yet,…

Removed extra filename parsing in metadata cleaner. If it hadn't been done yet, your files won't be renamed anyway.
parent 84f1fcbf
...@@ -48,7 +48,7 @@ namespace :paperclip do ...@@ -48,7 +48,7 @@ namespace :paperclip do
task :metadata => :environment do task :metadata => :environment do
for_all_attachments do |instance, name| for_all_attachments do |instance, name|
if file = instance.send(name).to_file if file = instance.send(name).to_file
instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip.gsub(/[^\w\d\.\-]+/, '_')) instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip
instance.send("#{name}_content_type=", file.content_type.strip) instance.send("#{name}_content_type=", file.content_type.strip)
instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size") instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size")
instance.save(false) instance.save(false)
......
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