Defect #32518

Incoming mails handled by MailHandler sometimes logs with the wrong locale

Added by Anthony Mallet over 1 year ago. Updated over 1 year ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-
Resolution: Affected version:4.0.5

Description

It happens from time to time that MailHandler logs errors related to incoming email messages
with the wrong locale (for instance in Japanese while my system is set to English by default).

For instance:
Nov 26 08:20:33 [ERROR] MailHandler: Validation failed: 类别 不能为空字符, 计划完成日期 不能为空字符, 预期时
Instead of:
Nov 26 16:18:02 [ERROR] MailHandler: Validation failed: Assignee cannot be blank, Category cannot be blank, Due date cannot be blank, Estimated time cannot be blank

I think this might be due to the locale leaking from previous unrelated requests, as
explained in e.g.:
https://edgeguides.rubyonrails.org/i18n.html#managing-the-locale-across-requests

Here is a tiny patch (agains 4.0.5) that explcitly sets the locale to English, since most of
the error messages printed in MailHandler are in English already. I set the locale just
before calling 'dispatch', as this is 'dispatch' that can actually make use of the locale.
But I guess it could be set anywhere that makes sense.

locale.patch Magnifier - Hardcode english locale in MailHandler (310 Bytes) Anthony Mallet, 2019-11-26 17:18

History

#1 Updated by Anthony Mallet over 1 year ago

A precision: the users that trigger this wrong locale for sure do not have their own language or anything set to Japanese.
They typically use English.

Also available in: Atom PDF