]> source.dussan.org Git - nextcloud-server.git/commitdiff
Better error handeling in testremote
authorRobin Appelman <icewind@owncloud.com>
Tue, 17 Jun 2014 11:15:34 +0000 (13:15 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 17 Jun 2014 11:15:34 +0000 (13:15 +0200)
apps/files_sharing/ajax/testremote.php

index 3d9092a034f4ff1ff23e1efef495907dc1792412..89581794698a4e1d56fa942f0fea06c0615a24d0 100644 (file)
@@ -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')) {