diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php index 2aae7bf1cd..450d160e23 100644 --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -626,6 +626,8 @@ abstract class DifferentialChangesetRenderer extends Phobject { unset($old['unix:filemode']); } + $metadata = $changeset->getMetadata(); + if ($this->hasOldFile()) { $file = $this->getOldFile(); if ($file->getImageWidth()) { @@ -634,6 +636,12 @@ abstract class DifferentialChangesetRenderer extends Phobject { } $old['file:mimetype'] = $file->getMimeType(); $old['file:size'] = phutil_format_bytes($file->getByteSize()); + } else { + $old['file:mimetype'] = idx($metadata, 'old:file:mime-type'); + $size = idx($metadata, 'old:file:size'); + if ($size !== null) { + $old['file:size'] = phutil_format_bytes($size); + } } if ($this->hasNewFile()) { @@ -644,6 +652,12 @@ abstract class DifferentialChangesetRenderer extends Phobject { } $new['file:mimetype'] = $file->getMimeType(); $new['file:size'] = phutil_format_bytes($file->getByteSize()); + } else { + $new['file:mimetype'] = idx($metadata, 'new:file:mime-type'); + $size = idx($metadata, 'new:file:size'); + if ($size !== null) { + $new['file:size'] = phutil_format_bytes($size); + } } return array($old, $new); diff --git a/src/applications/differential/render/DifferentialChangesetTestRenderer.php b/src/applications/differential/render/DifferentialChangesetTestRenderer.php index 429dbeda0a..a0d1fad0eb 100644 --- a/src/applications/differential/render/DifferentialChangesetTestRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTestRenderer.php @@ -32,6 +32,13 @@ abstract class DifferentialChangesetTestRenderer $changeset = $this->getChangeset(); list($old, $new) = $this->getChangesetProperties($changeset); + foreach (array_keys($old) as $key) { + if ($old[$key] === idx($new, $key)) { + unset($old[$key]); + unset($new[$key]); + } + } + if (!$old && !$new) { return null; }