]> git.mxchange.org Git - friendica.git/commitdiff
Fixes empty feed preview data
authorMichael <heluecht@pirati.ca>
Thu, 17 Sep 2020 10:36:33 +0000 (10:36 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 17 Sep 2020 10:36:33 +0000 (10:36 +0000)
src/Protocol/Feed.php

index 560fe005e6dbe0b9645b8ea051f5542ead90cce0..7ed94f9f14215e648129566e685dce893ecc6e72 100644 (file)
@@ -533,6 +533,9 @@ class Feed
                                        $replace = true;
                                }
 
+                               $saved_body = $item["body"];
+                               $saved_title = $item["title"];
+
                                if ($replace) {
                                        $item["body"] = trim($item["title"]);
                                }
@@ -549,9 +552,17 @@ class Feed
                                        }
                                }
 
+                               $data = PageInfo::queryUrl($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? '');
+
+                               // Take the data that was provided by the feed if the query wasn't empty
+                               if (($data['type'] == 'link') && empty($data['title']) && empty($data['text'])) {
+                                       $data['title'] = $saved_title;
+                                       $item["body"] = $saved_body;
+                               }
+
                                // We always strip the title since it will be added in the page information
                                $item["title"] = "";
-                               $item["body"] = $item["body"] . "\n" . PageInfo::getFooterFromUrl($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? '');
+                               $item["body"] = $item["body"] . "\n" . PageInfo::getFooterFromData($data, false);
                                $taglist = $contact["fetch_further_information"] == 2 ? PageInfo::getTagsFromUrl($item["plink"], $preview, $contact["ffi_keyword_denylist"] ?? '') : [];
                                $item["object-type"] = Activity\ObjectType::BOOKMARK;
                                unset($item["attach"]);