From 9e6bb3c5a8fa2fad5f7ac9721505806d27444801 Mon Sep 17 00:00:00 2001 From: Mikhail Kotelnikov Date: Sat, 16 Nov 2024 11:20:43 +0500 Subject: [PATCH] fix(job): Check if carddata is resource and read it to string Fixes nextcloud/server#46100 Co-authored-by: Christoph Wurst Signed-off-by: Mikhail Kotelnikov --- .../lib/Migration/BuildSocialSearchIndexBackgroundJob.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php index 05ad95c595c08..65786c044fed0 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -110,7 +110,11 @@ private function buildIndex($offset, $stopAt) { // refresh identified contacts in order to re-index foreach ($social_cards as $contact) { $offset = $contact['id']; - $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $contact['carddata']); + $cardData = $contact['carddata']; + if (is_resource($cardData) && (get_resource_type($cardData) === 'stream')) { + $cardData = stream_get_contents($cardData); + } + $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $cardData); // stop after 15sec (to be continued with next chunk) if (($this->timeFactory->getTime() - $startTime) > 15) {