From 15f6216634fcc33ec119dbcebdd8ab03a3d0c305 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 6 Feb 2012 11:58:21 -0800 Subject: [PATCH] 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 --- .../DifferentialChangesetViewController.php | 25 ++++++++----------- .../controller/changesetview/__init__.php | 1 - 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php b/src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php index 75975104ee..5bdfcdf8ee 100644 --- a/src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php @@ -48,20 +48,17 @@ class DifferentialChangesetViewController extends DifferentialController { $view = $request->getStr('view'); if ($view) { $changeset->attachHunks($changeset->loadHunks()); - $type = $changeset->getFileType(); - if ($type === DifferentialChangeType::FILE_TEXT) { - switch ($view) { - case 'new': - return $this->buildRawFileResponse($changeset->makeNewFile()); - case 'old': - return $this->buildRawFileResponse($changeset->makeOldFile()); - 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/"); + $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()); + case 'old': + return $this->buildRawFileResponse($changeset->makeOldFile()); + default: + return new Aphront400Response(); } } diff --git a/src/applications/differential/controller/changesetview/__init__.php b/src/applications/differential/controller/changesetview/__init__.php index dd03e94eeb..c1564fe51c 100644 --- a/src/applications/differential/controller/changesetview/__init__.php +++ b/src/applications/differential/controller/changesetview/__init__.php @@ -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');