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:
parent
8af29f2df1
commit
d5925ffc57
1 changed files with 24 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue