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,6 +33,11 @@ $externalManager = new \OCA\Files_Sharing\External\Manager(
$name = OCP\Files::buildNotExistingFileName('/', $name);
// check for ssl cert
if (substr($remote, 0, 5) === 'https' and !OC_Util::getUrlContent($remote)) {
\OCP\JSON::error(array('data' => array('message' => $l->t("Invalid or untrusted ssl certificate"))));
exit;
} else {
$mount = $externalManager->addShare($remote, $token, $password, $name, $owner);
/**
* @var \OCA\Files_Sharing\External\Storage $storage
@ -46,3 +51,4 @@ if($result){
$externalManager->removeShare($mount->getMountPoint());
\OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't add remote share"))));
}
}