mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 14:51:06 +01:00
Don't fatal when generating patch emails for diffs with binaries
Summary: When Phabricator is configured to generate patch email, we'll fatal if the patch contains binaries and is generating to Git because ArcanistBundle can't load the binary data. Provide a callback to load the data. See D2174. (This may cause us to generate absolutely enormous emails, but you get what you asked for...) Test Plan: Created a diff with an image under "send git patches" email configuration. Reviewers: Makinde, btrahan, vrana, jungejason Reviewed By: Makinde CC: aran Differential Revision: https://secure.phabricator.com/D2175
This commit is contained in:
parent
974b576df0
commit
32f12d1f8f
2 changed files with 13 additions and 0 deletions
|
@ -112,6 +112,16 @@ abstract class DifferentialReviewRequestMail extends DifferentialMail {
|
|||
return $attachments;
|
||||
}
|
||||
|
||||
public function loadFileByPHID($phid) {
|
||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$phid);
|
||||
if (!$file) {
|
||||
return null;
|
||||
}
|
||||
return $file->loadFileData();
|
||||
}
|
||||
|
||||
private function buildPatch() {
|
||||
$revision = $this->getRevision();
|
||||
$revision_id = $revision->getID();
|
||||
|
@ -133,6 +143,8 @@ abstract class DifferentialReviewRequestMail extends DifferentialMail {
|
|||
}
|
||||
$bundle = ArcanistBundle::newFromChanges($changes);
|
||||
|
||||
$bundle->setLoadFileDataCallback(array($this, 'loadFileByPHID'));
|
||||
|
||||
$format = PhabricatorEnv::getEnvConfig('metamta.differential.patch-format');
|
||||
switch ($format) {
|
||||
case 'git':
|
||||
|
|
|
@ -10,6 +10,7 @@ phutil_require_module('arcanist', 'parser/bundle');
|
|||
phutil_require_module('arcanist', 'parser/diff/change');
|
||||
|
||||
phutil_require_module('phabricator', 'applications/differential/mail/base');
|
||||
phutil_require_module('phabricator', 'applications/files/storage/file');
|
||||
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
|
Loading…
Reference in a new issue