]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't show storage space warning when the free space can't be determined
authorRobin Appelman <icewind@owncloud.com>
Fri, 15 Mar 2013 15:46:20 +0000 (16:46 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 15 Mar 2013 15:46:20 +0000 (16:46 +0100)
lib/helper.php

index 687f61520a53edaef49ea5394defc5a0cf76c021..73484ad913f2ba4addfce838a99cac0da1449eb6 100644 (file)
@@ -812,11 +812,19 @@ class OC_Helper {
                        $used = 0;
                }
                $free = \OC\Files\Filesystem::free_space();
-               $total = $free + $used;
+               if ($free >= 0){
+                       $total = $free + $used;
+               } else {
+                       $total = $free; //either unknown or unlimited
+               }
                if ($total == 0) {
                        $total = 1; // prevent division by zero
                }
-               $relative = round(($used / $total) * 10000) / 100;
+               if ($total >= 0){
+                       $relative = round(($used / $total) * 10000) / 100;
+               } else {
+                       $relative = 0;
+               }
 
                return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
        }