1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00

Add another pattern to quoted email body stripping

Summary:
Ref T3217. @hlau has an email client which quotes text with:

  ________________________________________
  From: ...

Add a regular expression to correctly detect this as quoted body text.

Test Plan: Add unit test; executed unit test.

Reviewers: btrahan, chad

Reviewed By: chad

CC: hlau, aran

Maniphest Tasks: T3217

Differential Revision: https://secure.phabricator.com/D5986
This commit is contained in:
epriestley 2013-05-20 15:52:54 -07:00
parent bb45f5eff5
commit 80024f051e
3 changed files with 17 additions and 7 deletions

View file

@ -1118,8 +1118,8 @@ phutil_register_library_map(array(
'PhabricatorMetaMTAConfigOptions' => 'applications/config/option/PhabricatorMetaMTAConfigOptions.php',
'PhabricatorMetaMTAController' => 'applications/metamta/controller/PhabricatorMetaMTAController.php',
'PhabricatorMetaMTADAO' => 'applications/metamta/storage/PhabricatorMetaMTADAO.php',
'PhabricatorMetaMTAEmailBodyParser' => 'applications/metamta/PhabricatorMetaMTAEmailBodyParser.php',
'PhabricatorMetaMTAEmailBodyParserTestCase' => 'applications/metamta/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php',
'PhabricatorMetaMTAEmailBodyParser' => 'applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php',
'PhabricatorMetaMTAEmailBodyParserTestCase' => 'applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php',
'PhabricatorMetaMTAListController' => 'applications/metamta/controller/PhabricatorMetaMTAListController.php',
'PhabricatorMetaMTAMail' => 'applications/metamta/storage/PhabricatorMetaMTAMail.php',
'PhabricatorMetaMTAMailBody' => 'applications/metamta/view/PhabricatorMetaMTAMailBody.php',
@ -2293,11 +2293,7 @@ phutil_register_library_map(array(
'DivinerFileAtomizer' => 'DivinerAtomizer',
'DivinerGenerateWorkflow' => 'DivinerWorkflow',
'DivinerListController' => 'PhabricatorController',
'DivinerLiveAtom' =>
array(
0 => 'DivinerDAO',
1 => 'PhabricatorPolicyInterface',
),
'DivinerLiveAtom' => 'DivinerDAO',
'DivinerLiveBook' =>
array(
0 => 'DivinerDAO',

View file

@ -24,6 +24,12 @@ final class PhabricatorMetaMTAEmailBodyParser {
'',
$body);
// See example in T3217.
$body = preg_replace(
'/^________________________________________\s+From:.*?/imsU',
'',
$body);
return rtrim($body);
}

View file

@ -102,6 +102,14 @@ OKAY
Sent from my iPhone
EOEMAIL
,
<<<EOMAIL
OKAY
________________________________________
From: Abraham Lincoln <alincoln@logcab.in>
Subject: Core World Tariffs
EOMAIL
,
);
}