From 89d43acdbc109f9d5283def98cb3cc1c1534e939 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 9881d2903cbc5..873f3a063ebe9 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -89,7 +89,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->time->getTime() - $startTime) > 15) {