@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Stop the bleeding caused by attaching enormous patches to revision mail

Summary:
Ref T12033. This is a very narrow fix for this issue, but it should fix the major error: don't attach patches if they're bigger than the mail body limit (by default, 512KB).

Specifically, the logs from an install in T12033 show a 112MB patch being attached, and that's the biggest practical problem here.

I'll follow up on the tasks with more nuanced future work.

Test Plan: Enabled `differential.attach-patches`, saw a patch attached to email. Set the byte limit very low, saw patches get thrown away.

Reviewers: chad, amckinley

Reviewed By: amckinley

Maniphest Tasks: T12033

Differential Revision: https://secure.phabricator.com/D18598

+8 -4
+8 -4
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 766 766 } 767 767 768 768 if ($config_attach) { 769 - $name = pht('D%s.%s.patch', $object->getID(), $diff->getID()); 770 - $mime_type = 'text/x-patch; charset=utf-8'; 771 - $body->addAttachment( 772 - new PhabricatorMetaMTAAttachment($patch, $name, $mime_type)); 769 + // See T12033, T11767, and PHI55. This is a crude fix to stop the 770 + // major concrete problems that lackluster email size limits cause. 771 + if (strlen($patch) < $body_limit) { 772 + $name = pht('D%s.%s.patch', $object->getID(), $diff->getID()); 773 + $mime_type = 'text/x-patch; charset=utf-8'; 774 + $body->addAttachment( 775 + new PhabricatorMetaMTAAttachment($patch, $name, $mime_type)); 776 + } 773 777 } 774 778 } 775 779 }