Remove EOLs from attachments filename (#14819).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12129 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-09-11 21:31:59 +00:00
parent 02fca76c13
commit 9149425750
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
class RemoveEolsFromAttachmentsFilename < ActiveRecord::Migration
def up
Attachment.where("filename like ? or filename like ?", "%\r%", "%\n%").each do |attachment|
filename = attachment.filename.to_s.tr("\r\n", "_")
Attachment.where(:id => attachement.id).update_all(:filename => filename)
end
end
def down
# nop
end
end