mirror of
https://github.com/discourse/discourse.git
synced 2025-04-08 18:21:16 +08: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
|
def handle_mail
|
||||||
params.require(:email)
|
params.require(:email)
|
||||||
|
retry_count = 0
|
||||||
|
|
||||||
|
begin
|
||||||
Jobs.enqueue(:process_email, mail: params[:email], retry_on_rate_limit: true)
|
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"
|
render plain: "email has been received and is queued for processing"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user