From 335513de617f4a7c6449cd715dbec5d6eefec3b8 Mon Sep 17 00:00:00 2001 From: sghebuz Date: Mon, 7 Mar 2016 23:15:57 +0100 Subject: [PATCH] Fix mbox.rb for updated Email::Receiver API This commit https://github.com/discourse/discourse/commit/30836573587079c5e663d7b3122957fc8c70dafe broke mbox importer.it. Update the mbox importer for the new Email::Receiver API --- script/import_scripts/mbox.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/import_scripts/mbox.rb b/script/import_scripts/mbox.rb index a7773f0a567..7e93c9e5c68 100755 --- a/script/import_scripts/mbox.rb +++ b/script/import_scripts/mbox.rb @@ -125,11 +125,11 @@ class ImportScripts::Mbox < ImportScripts::Base end def parse_email(msg) - receiver = Email::Receiver.new(msg, skip_sanity_check: true) + receiver = Email::Receiver.new(msg) mail = Mail.read_from_string(msg) mail.body - selected = receiver.select_body(mail) + selected = receiver.select_body selected.force_encoding(selected.encoding).encode("UTF-8") end @@ -147,11 +147,11 @@ class ImportScripts::Mbox < ImportScripts::Base create_posts(topics, total: topic_count, offset: offset) do |t| raw_email = File.read(t['file']) - receiver = Email::Receiver.new(raw_email, skip_sanity_check: true) + receiver = Email::Receiver.new(raw_email) mail = Mail.read_from_string(raw_email) mail.body - selected = receiver.select_body(mail) + selected = receiver.select_body next unless selected raw = selected.force_encoding(selected.encoding).encode("UTF-8") @@ -190,11 +190,11 @@ class ImportScripts::Mbox < ImportScripts::Base next unless topic_id raw_email = File.read(p['file']) - receiver = Email::Receiver.new(raw_email, skip_sanity_check: true) + receiver = Email::Receiver.new(raw_email) mail = Mail.read_from_string(raw_email) mail.body - selected = receiver.select_body(mail) + selected = receiver.select_body raw = selected.force_encoding(selected.encoding).encode("UTF-8") { id: id,