From 7f2a57f21699ea4d817df729cea2bb6a560f84ea Mon Sep 17 00:00:00 2001 From: Benjamin Brahmer Date: Tue, 31 Dec 2024 19:39:45 +0100 Subject: [PATCH] if title field does not exist look for text Signed-off-by: Benjamin Brahmer --- CHANGELOG.md | 1 + lib/Utility/OPMLImporter.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2c8ee948..626471219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the ### Changed ### Fixed +- OPML import use text field for title if title field is missing (#3016) # Releases ## [25.2.0-beta.1] - 2024-12-30 diff --git a/lib/Utility/OPMLImporter.php b/lib/Utility/OPMLImporter.php index 0068f3e71..b8938a8e4 100644 --- a/lib/Utility/OPMLImporter.php +++ b/lib/Utility/OPMLImporter.php @@ -65,10 +65,12 @@ public function import(string $userId, string $data): ?array private function outlineToItem(DOMElement $outline, ?string $parent = null): void { if ($outline->getAttribute('type') === 'rss') { + // take title if available, otherwise use text #2896 + $title = $outline->getAttribute('title') ?? $outline->getAttribute('text'); $feed = [ 'link' => $outline->getAttribute('htmlUrl'), 'url' => $outline->getAttribute('xmlUrl'), - 'title' => $outline->getAttribute('title'), + 'title' => $title, 'folder' => $parent, ];