20180711080554_issue_2100_utf8_encode_http_logs.rb 531 B

12345678910111213
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue2100Utf8EncodeHttpLogs < ActiveRecord::Migration[5.1]
  3. def up
  4. HttpLog.where('request LIKE :enctag OR response LIKE :enctag', enctag: '%content: !binary |%')
  5. .limit(100_000)
  6. .reorder(created_at: :desc)
  7. .find_each do |log|
  8. log.update(request: log.request.transform_values(&:utf8_encode),
  9. response: log.response.transform_values(&:utf8_encode))
  10. end
  11. end
  12. end