From fbc1cd25288ebf5e972aa1eabc38afcafcd6b46b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 17 Sep 2020 10:36:33 +0000 Subject: [PATCH] Fixes empty feed preview data --- src/Protocol/Feed.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 560fe005e6..7ed94f9f14 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -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"]);