]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Fix bug: URLs were escaped too often in bookmark list
authorChristian Weiske <cweiske@cweiske.de>
Wed, 17 Aug 2011 16:20:52 +0000 (18:20 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 5 Sep 2011 16:50:49 +0000 (18:50 +0200)
data/templates/default/bookmarks.tpl.php
doc/ChangeLog
tests/www/bookmarksTest.php

index 0ed9c1d5615a5aef137f867e56befd2c32d7a1a7..70fe788ff37f5d1f98fe71df59c766033c2d6aa0 100644 (file)
@@ -107,7 +107,7 @@ if($userservice->isLoggedOn()) {
 }
 ?>
 
-<?php if (count($bookmarks) > 0) { ?>
+<?php if (isset($bookmarks) && count($bookmarks) > 0) { ?>
 <script type="text/javascript">
 window.onload = playerLoad;
 </script>
@@ -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 '   <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">'
             . $cats . "\n"
index 942c65c13807fd30ec071e11a849504d096f90d5..1c5f36f0d4d13b7587a15efa6df7237efddd336a 100644 (file)
@@ -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
index ae82118e22386d5f10c2347acc3ad584354d518d..ac549d85bbb40c04b1130ffa036fef413060b1f6 100755 (executable)
@@ -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. & -> &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
 ?>