Give a better error message for external shares with self-signed ssl certificates

This commit is contained in:
Robin Appelman 2014-08-13 16:46:04 +02:00
parent 54491e8c68
commit 9509bc403a
1 changed files with 17 additions and 11 deletions

View File

@ -33,16 +33,22 @@ $externalManager = new \OCA\Files_Sharing\External\Manager(
$name = OCP\Files::buildNotExistingFileName('/', $name); $name = OCP\Files::buildNotExistingFileName('/', $name);
$mount = $externalManager->addShare($remote, $token, $password, $name, $owner); // check for ssl cert
/** if (substr($remote, 0, 5) === 'https' and !OC_Util::getUrlContent($remote)) {
* @var \OCA\Files_Sharing\External\Storage $storage \OCP\JSON::error(array('data' => array('message' => $l->t("Invalid or untrusted ssl certificate"))));
*/ exit;
$storage = $mount->getStorage();
$result = $storage->file_exists('');
if($result){
$storage->getScanner()->scanAll();
\OCP\JSON::success();
} else { } else {
$externalManager->removeShare($mount->getMountPoint()); $mount = $externalManager->addShare($remote, $token, $password, $name, $owner);
\OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share")))); /**
* @var \OCA\Files_Sharing\External\Storage $storage
*/
$storage = $mount->getStorage();
$result = $storage->file_exists('');
if ($result) {
$storage->getScanner()->scanAll();
\OCP\JSON::success();
} else {
$externalManager->removeShare($mount->getMountPoint());
\OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share"))));
}
} }