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

When a file is stored as chunks, show "Format: Chunks" instead of "Format: Raw"

Summary: Fixes T11712. This is somewhat misleading with encryption enabled.

Test Plan: Viewed chunked and unchunked files.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11712

Differential Revision: https://secure.phabricator.com/D16636
This commit is contained in:
epriestley 2016-09-29 15:40:48 -07:00
parent 8af29f2df1
commit d5925ffc57

View file

@ -285,12 +285,17 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
pht('Engine'),
$file->getStorageEngine());
$format_key = $file->getStorageFormat();
$format = PhabricatorFileStorageFormat::getFormat($format_key);
if ($format) {
$format_name = $format->getStorageFormatName();
$engine = $this->loadStorageEngine($file);
if ($engine && $engine->isChunkEngine()) {
$format_name = pht('Chunks');
} else {
$format_name = pht('Unknown ("%s")', $format_key);
$format_key = $file->getStorageFormat();
$format = PhabricatorFileStorageFormat::getFormat($format_key);
if ($format) {
$format_name = $format->getStorageFormatName();
} else {
$format_name = pht('Unknown ("%s")', $format_key);
}
}
$storage_properties->addProperty(pht('Format'), $format_name);
@ -369,13 +374,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
$box->addPropertyList($media);
}
$engine = null;
try {
$engine = $file->instantiateStorageEngine();
} catch (Exception $ex) {
// Don't bother raising this anywhere for now.
}
$engine = $this->loadStorageEngine($file);
if ($engine) {
if ($engine->isChunkEngine()) {
$chunkinfo = new PHUIPropertyListView();
@ -436,4 +435,17 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
}
private function loadStorageEngine(PhabricatorFile $file) {
$engine = null;
try {
$engine = $file->instantiateStorageEngine();
} catch (Exception $ex) {
// Don't bother raising this anywhere for now.
}
return $engine;
}
}