Defect #32518

Incoming mails handled by MailHandler sometimes logs with the wrong locale

Added by Anthony Mallet about 3 years ago. Updated about 3 years ago.

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


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


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.:

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


#1 Updated by Anthony Mallet about 3 years 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