From b34d5bf44ba96b7b11d7a72e1056a979406b3e93 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 14 May 2015 13:04:44 -0700 Subject: [PATCH] Strip GMail French quote header Summary: Ref T8199. Add pattern matching for GMail French. Test Plan: - Switched Gmail to french. - Replied to some mail. - Extracted quoted text header. - Added and executed unit test. Reviewers: btrahan Reviewed By: btrahan Subscribers: tycho.tatitscheff, epriestley Maniphest Tasks: T8199 Differential Revision: https://secure.phabricator.com/D12845 --- .../metamta/parser/PhabricatorMetaMTAEmailBodyParser.php | 6 ++++++ .../PhabricatorMetaMTAEmailBodyParserTestCase.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php index 5138c1a2bd..07770600e6 100644 --- a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php +++ b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php @@ -123,6 +123,12 @@ final class PhabricatorMetaMTAEmailBodyParser { '', $body); + // French GMail quoted text. See T8199. + $body = preg_replace( + '/^\s*\d{4}-\d{2}-\d{2} \d+:\d+ GMT.*:.*?/imsU', + '', + $body); + return rtrim($body); } diff --git a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php index 6a124e30f4..d8ad49956d 100644 --- a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php +++ b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php @@ -253,6 +253,13 @@ OKAY {$emdash} Sent from Mailbox +EOMAIL +, +<<: +> ... EOMAIL ); }