aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CardDAV/HasPhotoPlugin.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-03-12 11:26:31 +0100
committerGeorg Ehrke <developer@georgehrke.com>2020-04-15 15:49:39 +0200
commit648c8df51645147f99fd687511003062ae01978c (patch)
tree54c978f8b7a24aa52dd341a17828a5b5326c8583 /apps/dav/lib/CardDAV/HasPhotoPlugin.php
parentbb754cb363ef4a7b5f0fd4a8a9c9baf1c699b571 (diff)
downloadnextcloud-server-648c8df51645147f99fd687511003062ae01978c.tar.gz
nextcloud-server-648c8df51645147f99fd687511003062ae01978c.zip
Don't populate the PHOTO property when it's not an image
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/lib/CardDAV/HasPhotoPlugin.php')
-rw-r--r--apps/dav/lib/CardDAV/HasPhotoPlugin.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/dav/lib/CardDAV/HasPhotoPlugin.php b/apps/dav/lib/CardDAV/HasPhotoPlugin.php
index bb847e74a37..cf9d68e14a4 100644
--- a/apps/dav/lib/CardDAV/HasPhotoPlugin.php
+++ b/apps/dav/lib/CardDAV/HasPhotoPlugin.php
@@ -62,7 +62,12 @@ class HasPhotoPlugin extends ServerPlugin {
if ($node instanceof Card) {
$propFind->handle($ns . 'has-photo', function () use ($node) {
$vcard = Reader::read($node->get());
- return ($vcard instanceof VCard && $vcard->PHOTO);
+ return $vcard instanceof VCard
+ && $vcard->PHOTO
+ // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/
+ && (strpos($vcard->PHOTO->getValue(), 'data:') !== 0
+ || strpos($vcard->PHOTO->getValue(), 'data:image/') === 0)
+ ;
});
}
}