diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20130911193200_remove_eols_from_attachments_filename.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20130911193200_remove_eols_from_attachments_filename.rb b/db/migrate/20130911193200_remove_eols_from_attachments_filename.rb new file mode 100644 index 000000000..3708031e0 --- /dev/null +++ b/db/migrate/20130911193200_remove_eols_from_attachments_filename.rb @@ -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 |