mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 12:02:05 +08:00
FIX: Catch UndefinedConversionError for inbound emails (#13000)
Some emails coming in via the mail receiver can still end up with bad encoding when trying to enqueue the job. This catches the last encoding issue and forces iso-8559-1 and encodes to UTF-8 to circumvent the issue.
This commit is contained in:
@ -158,7 +158,7 @@ class Admin::EmailController < Admin::AdminController
|
||||
|
||||
begin
|
||||
Jobs.enqueue(:process_email, mail: email_raw, retry_on_rate_limit: true, source: :handle_mail)
|
||||
rescue JSON::GeneratorError => e
|
||||
rescue JSON::GeneratorError, Encoding::UndefinedConversionError => e
|
||||
if retry_count == 0
|
||||
email_raw = email_raw.force_encoding('iso-8859-1').encode("UTF-8")
|
||||
retry_count += 1
|
||||
|
Reference in New Issue
Block a user