From 8a97afac6f7ba2e552c01ff3cb0477f5beb8fc92 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Fri, 15 Mar 2013 16:46:20 +0100
Subject: [PATCH] Don't show storage space warning when the free space can't be
 determined

---
 lib/helper.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/helper.php b/lib/helper.php
index 687f61520a5..73484ad913f 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -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);
 	}
-- 
GitLab