From 38ec2a35f2bfec8421578a778ec91d3901b279a1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 24 Jan 2017 16:56:24 +0100 Subject: [PATCH] Make DAV external storage test more reliable Signed-off-by: Robin Appelman --- lib/private/Files/Storage/Common.php | 10 +++++++--- lib/private/Files/Storage/DAV.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 5561f6a889b..f3e3cb9e58c 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -436,10 +436,14 @@ abstract class Common implements Storage, ILockingStorage { * @return bool */ public function test() { - if ($this->stat('')) { - return true; + try { + if ($this->stat('')) { + return true; + } + return false; + } catch (\Exception $e) { + return false; } - return false; } /** diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index abe219f99f2..3b89a66d6a2 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -569,8 +569,8 @@ class DAV extends Common { public function stat($path) { try { $response = $this->propfind($path); - if ($response === false) { - return []; + if (!$response) { + return false; } return [ 'mtime' => strtotime($response['{DAV:}getlastmodified']), -- 2.39.5