From 21d825ed6c11425d36a143f8ed63f1e3852d0aeb Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Mon, 27 Oct 2014 16:27:12 +0100
Subject: [PATCH] Properly catch 503 storage not available in getQuotaInfo

When doing a PROPFIND on the root and one of the mount points is not
available, the returned quota attributes will now be zero.

This fix prevents the expected exception to make the whole call fail.
---
 lib/private/connector/sabre/directory.php | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/private/connector/sabre/directory.php b/lib/private/connector/sabre/directory.php
index 1b6d1f363b8..0d35c7d528e 100644
--- a/lib/private/connector/sabre/directory.php
+++ b/lib/private/connector/sabre/directory.php
@@ -205,13 +205,17 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node
 	 * @return array
 	 */
 	public function getQuotaInfo() {
-		$path = \OC\Files\Filesystem::getView()->getRelativePath($this->info->getPath());
-		$storageInfo = OC_Helper::getStorageInfo($path);
-		return array(
-			$storageInfo['used'],
-			$storageInfo['free']
-		);
-
+		try {
+			$path = \OC\Files\Filesystem::getView()->getRelativePath($this->info->getPath());
+			$storageInfo = OC_Helper::getStorageInfo($path);
+			return array(
+				$storageInfo['used'],
+				$storageInfo['free']
+			);
+		}
+		catch (\OCP\Files\StorageNotAvailableException $e) {
+			return array(0, 0);
+		}
 	}
 
 	/**
-- 
GitLab