From: Robin Appelman Date: Tue, 17 Jun 2014 11:15:34 +0000 (+0200) Subject: Better error handeling in testremote X-Git-Tag: v7.0.0alpha2~16^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f2ebac5c768eef702d523c157d882bd7deb36930;p=nextcloud-server.git Better error handeling in testremote --- diff --git a/apps/files_sharing/ajax/testremote.php b/apps/files_sharing/ajax/testremote.php index 3d9092a034f..89581794698 100644 --- a/apps/files_sharing/ajax/testremote.php +++ b/apps/files_sharing/ajax/testremote.php @@ -11,9 +11,13 @@ OCP\JSON::checkAppEnabled('files_sharing'); $remote = $_GET['remote']; function testUrl($url) { - $result = file_get_contents($url); - $data = json_decode($result); - return is_object($data) and !empty($data->version); + try { + $result = file_get_contents($url); + $data = json_decode($result); + return is_object($data) and !empty($data->version); + } catch (Exception $e) { + return false; + } } if (testUrl('https://' . $remote . '/status.php')) {