diff --git a/3rdparty b/3rdparty index 4b46a9176e392..b0f180458ab55 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 4b46a9176e392932702be12060a8c5899e092174 +Subproject commit b0f180458ab55af9d6a1550f2b62dee3fdc6e1ef diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index f240e04c7214a..4c8d7d679d38a 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -221,8 +221,10 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) { $totalSpace = $this->l10n->t('Unlimited'); } else { - $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); + $totalSpace = $this->reduceStorageSizeBySensibleBoundaries($storageInfo['total']); } + + $nav->assign('total_space', $totalSpace); $nav->assign('quota', $storageInfo['quota']); $nav->assign('usage_relative', $storageInfo['relative']); @@ -306,4 +308,24 @@ private function showFile($fileId) { } throw new \OCP\Files\NotFoundException(); } + + + /** + * Cuts of an int containing the amount of bytes of a given size, to a sensible way. It converts the bytecount to a human readable size, and then cuts it down under a certain threshhold. + * + * @param int $storage storagevalue to be cut off + * @return int human readable filesize which is reduced to a sensible value. + */ + private function reduceStorageSizeBySensibleBoundaries($storage) { + + $reducedStorageSize = \OC_Helper::humanFileSize($storage); + + if ($storage > 104857600 && $storage < 1073741824) { //Over 100MB under 1GB + $reducedStorageSize = round($reducedStorageSize); + } else if ($storage > 107374182400 && $storage < 1099511531399) { //Over 100GB under 1TB + $reducedStorageSize = round($reducedStorageSize); + } + + return $reducedStorageSize; + } } diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 0b9ac665901f3..e6fd54fbd05f9 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -17,7 +17,7 @@ class="pinned
t('%s of %s used', [$_['usage'], $_['total_space']])); + p($l->t('%s of %s', [$_['usage'], $_['total_space']])); } else { p($l->t('%s used', [$_['usage']])); } ?>