]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(job): Check if carddata is resource and read it to string backport/49332/stable28 49388/head
authorMikhail Kotelnikov <fox@woland.me>
Sat, 16 Nov 2024 06:20:43 +0000 (11:20 +0500)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 19 Nov 2024 18:29:36 +0000 (18:29 +0000)
Fixes nextcloud/server#46100

Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
Signed-off-by: Mikhail Kotelnikov <fox@woland.me>
apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php

index 05ad95c595c08baae055e7f605962086d3d713b7..65786c044fed00d4503347c5cd6be4369c533a2c 100644 (file)
@@ -110,7 +110,11 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob {
                // 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) {