From 34600fe502c625217776c909903035d9ab937dea Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 17 Aug 2011 18:20:52 +0200 Subject: Fix bug: URLs were escaped too often in bookmark list --- data/templates/default/bookmarks.tpl.php | 6 +++--- doc/ChangeLog | 5 +++++ tests/www/bookmarksTest.php | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php index 0ed9c1d..70fe788 100644 --- a/data/templates/default/bookmarks.tpl.php +++ b/data/templates/default/bookmarks.tpl.php @@ -107,7 +107,7 @@ if($userservice->isLoggedOn()) { } ?> - 0) { ?> + 0) { ?> @@ -358,7 +358,7 @@ if ($currenttag!= '') { $rel = ' rel="nofollow"'; } - $address = filter($row['bAddress']); + $address = $row['bAddress']; $oaddress = $address; // Redirection option if ($GLOBALS['useredir']) { @@ -418,7 +418,7 @@ if ($currenttag!= '') { } echo '
'. nl2br($bkDescription) ."
\n"; - echo '
' . shortenString($oaddress) . "
\n"; + echo '
' . htmlspecialchars(shortenString($oaddress)) . "
\n"; echo '
' . $cats . "\n" diff --git a/doc/ChangeLog b/doc/ChangeLog index 942c65c..1c5f36f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,6 +3,11 @@ ChangeLog for SemantiScuttle .. contents:: +0.98.4 - 2011-XX-XX +------------------- +- Fix bug: URLs were escaped too often in bookmark list + + 0.98.3 - 2011-08-09 ------------------- - Fix bug #3388456: Missing scripts/fix-unfiled-tags.php diff --git a/tests/www/bookmarksTest.php b/tests/www/bookmarksTest.php index ae82118..ac549d8 100755 --- a/tests/www/bookmarksTest.php +++ b/tests/www/bookmarksTest.php @@ -124,5 +124,33 @@ class www_bookmarksTest extends TestBaseApi $this->assertNotContains('privateKey=', (string)$elements[0]['href']); }//end testVerifyPrivateRSSLinkDoesNotExist + + + /** + * We once had the bug that URLs with special characters were escaped too + * often. & -> & + */ + public function testAddressEncoding() + { + $this->addBookmark(null, 'http://example.org?foo&bar=baz'); + + //get rid of bookmarks.php + $this->url = $GLOBALS['unittestUrl']; + + $html = $this->getRequest()->send()->getBody(); + $x = simplexml_load_string($html); + $ns = $x->getDocNamespaces(); + $x->registerXPathNamespace('ns', reset($ns)); + + $elements = $x->xpath('//ns:a[@class="taggedlink"]'); + $this->assertEquals( + 1, count($elements), 'Number of links is not 1' + ); + $this->assertEquals( + 'http://example.org?foo&bar=baz', + (string)$elements[0]['href'] + ); + } + }//end class www_bookmarksTest ?> -- cgit v1.2.3