mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 14:19:49 +08:00
Merge pull request #4063 from sghebuz/sghebuz-patch-1
Fix mbox.rb for updated Email::Receiver API
This commit is contained in:
commit
b35186bfe2
|
@ -125,11 +125,11 @@ class ImportScripts::Mbox < ImportScripts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_email(msg)
|
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 = Mail.read_from_string(msg)
|
||||||
mail.body
|
mail.body
|
||||||
|
|
||||||
selected = receiver.select_body(mail)
|
selected = receiver.select_body
|
||||||
selected.force_encoding(selected.encoding).encode("UTF-8")
|
selected.force_encoding(selected.encoding).encode("UTF-8")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,11 +147,11 @@ class ImportScripts::Mbox < ImportScripts::Base
|
||||||
|
|
||||||
create_posts(topics, total: topic_count, offset: offset) do |t|
|
create_posts(topics, total: topic_count, offset: offset) do |t|
|
||||||
raw_email = File.read(t['file'])
|
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 = Mail.read_from_string(raw_email)
|
||||||
mail.body
|
mail.body
|
||||||
|
|
||||||
selected = receiver.select_body(mail)
|
selected = receiver.select_body
|
||||||
next unless selected
|
next unless selected
|
||||||
|
|
||||||
raw = selected.force_encoding(selected.encoding).encode("UTF-8")
|
raw = selected.force_encoding(selected.encoding).encode("UTF-8")
|
||||||
|
@ -190,11 +190,11 @@ class ImportScripts::Mbox < ImportScripts::Base
|
||||||
next unless topic_id
|
next unless topic_id
|
||||||
|
|
||||||
raw_email = File.read(p['file'])
|
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 = Mail.read_from_string(raw_email)
|
||||||
mail.body
|
mail.body
|
||||||
|
|
||||||
selected = receiver.select_body(mail)
|
selected = receiver.select_body
|
||||||
raw = selected.force_encoding(selected.encoding).encode("UTF-8")
|
raw = selected.force_encoding(selected.encoding).encode("UTF-8")
|
||||||
|
|
||||||
{ id: id,
|
{ id: id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user