From b94f396c4fb6b0eb55c3cb768ff36e624ea43d9c 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 138f764f1e6c0..f727f4ea09a7d 100644 --- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php @@ -71,7 +71,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) {