From aa26a3ae749f624de63f9a274ff23d21c5160658 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 13 Mar 2017 16:54:27 +0100 Subject: [PATCH] use right format for avatars Signed-off-by: Bjoern Schiessle --- apps/dav/lib/CardDAV/Converter.php | 2 +- apps/dav/tests/unit/CardDAV/ConverterTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index eb43fe7d671..9e106a0fe28 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -78,7 +78,7 @@ class Converter { break; case AccountManager::PROPERTY_AVATAR: if ($image !== null) { - $vCard->add('PHOTO', 'data:'.$image->mimeType().';base64,' . base64_encode($image->data())); + $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]); } break; case AccountManager::PROPERTY_EMAIL: diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index ff218bfc78c..448d80f3070 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -146,7 +146,7 @@ class ConverterTest extends TestCase { [ 'cloud' => 'foo@cloud.net', 'email' => 'foo@bar.net', - 'photo' => 'data:image/jpeg;base64,MTIzNDU2Nzg5', + 'photo' => 'MTIzNDU2Nzg5', ], null, 'foo@bar.net', @@ -157,7 +157,7 @@ class ConverterTest extends TestCase { 'cloud' => 'foo@cloud.net', 'email' => 'foo@bar.net', 'fn' => 'Dr. Foo Bar', - 'photo' => 'data:image/jpeg;base64,MTIzNDU2Nzg5', + 'photo' => 'MTIzNDU2Nzg5', ], "Dr. Foo Bar", "foo@bar.net", @@ -167,7 +167,7 @@ class ConverterTest extends TestCase { [ 'cloud' => 'foo@cloud.net', 'fn' => 'Dr. Foo Bar', - 'photo' => 'data:image/jpeg;base64,MTIzNDU2Nzg5', + 'photo' => 'MTIzNDU2Nzg5', ], "Dr. Foo Bar", null, @@ -177,7 +177,7 @@ class ConverterTest extends TestCase { [ 'cloud' => 'foo@cloud.net', 'fn' => 'Dr. Foo Bar', - 'photo' => 'data:image/jpeg;base64,MTIzNDU2Nzg5', + 'photo' => 'MTIzNDU2Nzg5', ], 'Dr. Foo Bar', '', -- 2.39.5