diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 15:39:39 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 15:39:39 +0100 |
commit | ca5d72e6b0fb5d2b50bc20bd8f624a58bf0e4478 (patch) | |
tree | 38b2a0758129fb4911e92868a181c4046233c5a0 /apps/dav/lib/carddav/converter.php | |
parent | 8ad45dad38c2c502ac1fae48e4bc12ec3dcfd565 (diff) | |
download | nextcloud-server-ca5d72e6b0fb5d2b50bc20bd8f624a58bf0e4478.tar.gz nextcloud-server-ca5d72e6b0fb5d2b50bc20bd8f624a58bf0e4478.zip |
Catch potential exceptions when accessing the users avatar - e.g. issues with the encrypted file system - fixes #21983
Diffstat (limited to 'apps/dav/lib/carddav/converter.php')
-rw-r--r-- | apps/dav/lib/carddav/converter.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/dav/lib/carddav/converter.php b/apps/dav/lib/carddav/converter.php index 06d3cb4f18e..c8d9b94c267 100644 --- a/apps/dav/lib/carddav/converter.php +++ b/apps/dav/lib/carddav/converter.php @@ -39,7 +39,7 @@ class Converter { $displayName = empty($displayName ) ? $uid : $displayName; $emailAddress = $user->getEMailAddress(); $cloudId = $user->getCloudId(); - $image = $user->getAvatarImage(-1); + $image = $this->getAvatarImage($user); $vCard = new VCard(); $vCard->add(new Text($vCard, 'UID', $uid)); @@ -72,7 +72,7 @@ class Converter { $displayName = empty($displayName ) ? $uid : $displayName; $emailAddress = $user->getEMailAddress(); $cloudId = $user->getCloudId(); - $image = $user->getAvatarImage(-1); + $image = $this->getAvatarImage($user); $updated = false; if($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) { @@ -155,4 +155,17 @@ class Converter { return $result; } + /** + * @param IUser $user + * @return null|IImage + */ + private function getAvatarImage(IUser $user) { + try { + $image = $user->getAvatarImage(-1); + return $image; + } catch (\Exception $ex) { + return null; + } + } + } |