Fix bug: URLs were escaped too often in bookmark list

This commit is contained in:
Christian Weiske 2011-08-17 18:20:52 +02:00
parent a468938a5a
commit 196db46097
3 changed files with 36 additions and 3 deletions

View file

@ -107,7 +107,7 @@ if($userservice->isLoggedOn()) {
} }
?> ?>
<?php if (count($bookmarks) > 0) { ?> <?php if (isset($bookmarks) && count($bookmarks) > 0) { ?>
<script type="text/javascript"> <script type="text/javascript">
window.onload = playerLoad; window.onload = playerLoad;
</script> </script>
@ -358,7 +358,7 @@ if ($currenttag!= '') {
$rel = ' rel="nofollow"'; $rel = ' rel="nofollow"';
} }
$address = filter($row['bAddress']); $address = $row['bAddress'];
$oaddress = $address; $oaddress = $address;
// Redirection option // Redirection option
if ($GLOBALS['useredir']) { if ($GLOBALS['useredir']) {
@ -418,7 +418,7 @@ if ($currenttag!= '') {
} }
echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n"; echo ' <div class="description">'. nl2br($bkDescription) ."</div>\n";
echo ' <div class="address">' . shortenString($oaddress) . "</div>\n"; echo ' <div class="address">' . htmlspecialchars(shortenString($oaddress)) . "</div>\n";
echo ' <div class="meta">' echo ' <div class="meta">'
. $cats . "\n" . $cats . "\n"

View file

@ -3,6 +3,11 @@ ChangeLog for SemantiScuttle
.. contents:: .. contents::
0.98.4 - 2011-XX-XX
-------------------
- Fix bug: URLs were escaped too often in bookmark list
0.98.3 - 2011-08-09 0.98.3 - 2011-08-09
------------------- -------------------
- Fix bug #3388456: Missing scripts/fix-unfiled-tags.php - Fix bug #3388456: Missing scripts/fix-unfiled-tags.php

View file

@ -124,5 +124,33 @@ class www_bookmarksTest extends TestBaseApi
$this->assertNotContains('privateKey=', (string)$elements[0]['href']); $this->assertNotContains('privateKey=', (string)$elements[0]['href']);
}//end testVerifyPrivateRSSLinkDoesNotExist }//end testVerifyPrivateRSSLinkDoesNotExist
/**
* We once had the bug that URLs with special characters were escaped too
* often. & -> &amp;
*/
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 }//end class www_bookmarksTest
?> ?>