1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Do more error checking. Refs. #367

This commit is contained in:
Thomas Tanghus 2014-01-22 22:22:58 +01:00
parent a8de751533
commit b81a475b78
2 changed files with 8 additions and 1 deletions

View File

@ -122,6 +122,9 @@ class Shared extends Database {
$permissions = $addressBook['permissions'];
$card = parent::getContact($addressbookid, $id, $options);
if(!$card) {
throw new \Exception('Shared Contact not found: ' . implode(',', $id), 404);
}
$card['permissions'] = $permissions;
return $card;
}

View File

@ -198,7 +198,11 @@ class Backend extends \Sabre_CardDAV_Backend_Abstract {
*/
public function getCard($addressbookid, $carduri) {
list($id, $backend) = $this->getBackendForAddressBook($addressbookid);
$contact = $backend->getContact($id, array('uri' => urldecode($carduri)));
try {
$contact = $backend->getContact($id, array('uri' => urldecode($carduri)));
} catch(\Exception $e) {
throw new \Sabre_DAV_Exception_NotFound($e->getMessage());
}
return ($contact ? $contact : false);
}