From 774a266366ea624b403c242125e6f3dc4efcc525 Mon Sep 17 00:00:00 2001
From: Krylan <26091129+Krylan@users.noreply.github.com>
Date: Mon, 30 Sep 2024 23:31:24 +0200
Subject: [PATCH] use news link in RSS post when it is internal link (#2721)
---
public/rss-news.xml.php | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/public/rss-news.xml.php b/public/rss-news.xml.php
index 13fec0ae8a..cbb90168bf 100644
--- a/public/rss-news.xml.php
+++ b/public/rss-news.xml.php
@@ -34,14 +34,17 @@
$newsDate = date("D, d M Y H:i:s O", strtotime($news['Timestamp']));
$newsImage = $news['Image'];
$newsLink = config('app.url');
- $newsTitle = "";
+ if (str_starts_with($news['Link'], config('app.url'))) {
+ $newsLink = "";
+ }
+ $newsTitle = "";
// Image first?
$payload = "";
$payload .= "
\r\n";
$payload .= $news['Payload'];
- $newsPayload = "";
+ $newsPayload = "";
// $newsPayload contains relative URLs, which need converting to absolute URLs
$newsPayload = str_replace("href='/", "href='" . config('app.url') . "/", $newsPayload);
@@ -53,7 +56,7 @@
// ?!
$article->appendChild($dom->createElement('title', htmlentities($newsTitle)));
- $article->appendChild($dom->createElement('link', $newsLink));
+ $article->appendChild($dom->createElement('link', htmlentities($newsLink)));
$article->appendChild($dom->createElement('description', htmlentities($newsPayload)));
$article->appendChild($dom->createElement('pubDate', $newsDate));