Skip to content

Commit ae1a821

Browse files
author
epriestley
committed
Fix cancdn vs canCDN flag
Summary: Ref T5884. We migrated to add a `canCDN` flag, but the code looks for a `cancdn` flag. If this fixes the issue, I'll migrate `cancdn` to `canCDN` in the next diff. Test Plan: Viewed some files, including old files, and saw the cacheability I expected. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5884 Differential Revision: https://secure.phabricator.com/D10264
1 parent 6669fe9 commit ae1a821

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/applications/files/controller/PhabricatorFileInfoController.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,17 @@ private function buildPropertyViews(
213213
pht('%s px', new PhutilNumber($height)));
214214
}
215215

216-
$finfo->addProperty(
217-
pht('Cacheable'),
218-
$file->getCanCDN() ? pht('Yes') : pht('No'));
216+
$is_image = $file->isViewableImage();
217+
if ($is_image) {
218+
$image_string = pht('Yes');
219+
$cache_string = $file->getCanCDN() ? pht('Yes') : pht('No');
220+
} else {
221+
$image_string = pht('No');
222+
$cache_string = pht('Not Applicable');
223+
}
224+
225+
$finfo->addProperty(pht('Viewable Image'), $image_string);
226+
$finfo->addProperty(pht('Cacheable'), $cache_string);
219227

220228
$storage_properties = new PHUIPropertyListView();
221229
$box->addPropertyList($storage_properties, pht('Storage'));

src/applications/files/storage/PhabricatorFile.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
2828

2929
const METADATA_IMAGE_WIDTH = 'width';
3030
const METADATA_IMAGE_HEIGHT = 'height';
31-
const METADATA_CAN_CDN = 'cancdn';
31+
const METADATA_CAN_CDN = 'canCDN';
3232

3333
protected $name;
3434
protected $mimeType;
@@ -848,6 +848,12 @@ public function getCanCDN() {
848848
if (!$this->isViewableImage()) {
849849
return false;
850850
}
851+
852+
// TODO: Migrate away this old constant and remove this check.
853+
if (idx($this->metadata, 'cancdn')) {
854+
return true;
855+
}
856+
851857
return idx($this->metadata, self::METADATA_CAN_CDN);
852858
}
853859

0 commit comments

Comments
 (0)