summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CardDAV/CardDavBackend.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/CardDAV/CardDavBackend.php')
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index 1f87ca5f7c1..bfdf7e53f40 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -874,10 +874,33 @@ class CardDavBackend implements BackendInterface, SyncSupport {
private function readBlob($cardData) {
if (is_resource($cardData)) {
- return stream_get_contents($cardData);
+ $cardData = stream_get_contents($cardData);
}
- return $cardData;
+ $cardDataArray = explode("\r\n", $cardData);
+
+ $cardDataFiltered = [];
+ $removingPhoto = false;
+ foreach ($cardDataArray as $line) {
+ if (strpos($line, 'PHOTO:data:') === 0
+ && strpos($line, 'PHOTO:data:image/') !== 0) {
+ // Filter out PHOTO data of non-images
+ $removingPhoto = true;
+ continue;
+ }
+
+ if ($removingPhoto) {
+ if (strpos($line, ' ') === 0) {
+ continue;
+ }
+ // No leading space means this is a new property
+ $removingPhoto = false;
+ }
+
+ $cardDataFiltered[] = $line;
+ }
+
+ return implode("\r\n", $cardDataFiltered);
}
/**