Project

General

Profile

Actions

Defect #32518

open

Incoming mails handled by MailHandler sometimes logs with the wrong locale

Added by Anthony Mallet almost 5 years ago. Updated almost 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

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.


Files

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

Also available in: Atom PDF