1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Fix displaying of raw files in Differential

Summary:
See D1533#5.
Also deduplicates logic of what is stored to blob in ArcanistDiffWorkflow.

Blame Rev: D1533

Test Plan:
Display raw version of text file.
Display raw version of image.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1583
This commit is contained in:
vrana 2012-02-06 11:58:21 -08:00
parent d65f62d055
commit 15f6216634
2 changed files with 11 additions and 15 deletions

View file

@ -48,8 +48,10 @@ class DifferentialChangesetViewController extends DifferentialController {
$view = $request->getStr('view');
if ($view) {
$changeset->attachHunks($changeset->loadHunks());
$type = $changeset->getFileType();
if ($type === DifferentialChangeType::FILE_TEXT) {
$phid = idx($changeset->getMetadata(), "$view:binary-phid");
if ($phid) {
return id(new AphrontRedirectResponse())->setURI("/file/info/$phid/");
}
switch ($view) {
case 'new':
return $this->buildRawFileResponse($changeset->makeNewFile());
@ -58,11 +60,6 @@ class DifferentialChangesetViewController extends DifferentialController {
default:
return new Aphront400Response();
}
} else if ($type === DifferentialChangeType::FILE_IMAGE ||
$type === DifferentialChangeType::FILE_BINARY) {
$phid = idx($changeset->getMetadata(), "$view:binary-phid");
return id(new AphrontRedirectResponse())->setURI("/file/info/$phid/");
}
}
if ($vs && ($vs != -1)) {

View file

@ -13,7 +13,6 @@ phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'aphront/response/ajax');
phutil_require_module('phabricator', 'aphront/response/file');
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
phutil_require_module('phabricator', 'applications/differential/controller/base');
phutil_require_module('phabricator', 'applications/differential/parser/changeset');
phutil_require_module('phabricator', 'applications/differential/storage/changeset');