From fbc28ff1c892460e90e87a1be6dd3e28a4cd58b8 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 19 Oct 2016 11:05:20 +0200 Subject: [PATCH] Fix hashtags links in Feeds Make the hashtag link absolute in feeds to work properly in RSS syndication tools. --- CHANGELOG.md | 1 + application/FeedBuilder.php | 3 ++- tests/FeedBuilderTest.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60af7223..72914076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Plugins: - Tools: only display parameter description when it exists - archive.org: do not propose archival of private notes +- Use absolute URL for hashtags in RSS and ATOM feeds ### Security - Allow whitelisting trusted IPs, else continue banning clients upon login failure diff --git a/application/FeedBuilder.php b/application/FeedBuilder.php index c6657fbb..4036a7cc 100644 --- a/application/FeedBuilder.php +++ b/application/FeedBuilder.php @@ -153,7 +153,8 @@ protected function buildItem($link, $pageaddr) } else { $permalink = 'Permalink'; } - $link['description'] = format_description($link['description']) . PHP_EOL .'
— '. $permalink; + $link['description'] = format_description($link['description'], '', $pageaddr); + $link['description'] .= PHP_EOL .'
— '. $permalink; $pubDate = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); $link['pub_iso_date'] = $this->getIsoDate($pubDate); diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index aa57f44e..d7839402 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php @@ -249,5 +249,6 @@ public function testBuildDataServerSubdir() $link = array_shift($data['links']); $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); + $this->assertContains('http://host.tld:8080/~user/shaarli/?addtag=hashtag', $link['description']); } }