mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: Force the right encoding when handling email.
This commit is contained in:
parent
7873a2efb7
commit
e4b9f72f9e
@ -84,7 +84,20 @@ class Admin::EmailController < Admin::AdminController
|
||||
|
||||
def handle_mail
|
||||
params.require(:email)
|
||||
Jobs.enqueue(:process_email, mail: params[:email], retry_on_rate_limit: true)
|
||||
retry_count = 0
|
||||
|
||||
begin
|
||||
Jobs.enqueue(:process_email, mail: params[:email], retry_on_rate_limit: true)
|
||||
rescue JSON::GeneratorError => e
|
||||
if retry_count == 0
|
||||
params[:email] = params[:email].force_encoding('iso-8859-1').encode("UTF-8")
|
||||
retry_count += 1
|
||||
retry
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
render plain: "email has been received and is queued for processing"
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user