aboutsummaryrefslogtreecommitdiffstats
path: root/lib/template.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-14 23:39:31 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-14 23:39:31 +0100
commit44e5c052b3f4fdc352790aee982217a83f9449ef (patch)
tree83b48d0618f38a010e725f1580a472d362cc86f4 /lib/template.php
parent53ca0db434f3ad8d043a0a9b76bd59f22af38f99 (diff)
downloadnextcloud-server-44e5c052b3f4fdc352790aee982217a83f9449ef.tar.gz
nextcloud-server-44e5c052b3f4fdc352790aee982217a83f9449ef.zip
handling proper display of files/folders with negative size
refs #1162
Diffstat (limited to 'lib/template.php')
-rw-r--r--lib/template.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/template.php b/lib/template.php
index 04667d73a2c..f10a637346c 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -85,11 +85,21 @@ function human_file_size( $bytes ) {
}
function simple_file_size($bytes) {
- $mbytes = round($bytes/(1024*1024), 1);
- if($bytes == 0) { return '0'; }
- else if($mbytes < 0.1) { return '&lt; 0.1'; }
- else if($mbytes > 1000) { return '&gt; 1000'; }
- else { return number_format($mbytes, 1); }
+ if ($bytes < 0) {
+ return '?';
+ }
+ $mbytes = round($bytes / (1024 * 1024), 1);
+ if ($bytes == 0) {
+ return '0';
+ }
+ if ($mbytes < 0.1) {
+ return '&lt; 0.1';
+ }
+ if ($mbytes > 1000) {
+ return '&gt; 1000';
+ } else {
+ return number_format($mbytes, 1);
+ }
}
function relative_modified_date($timestamp) {