]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fixes #426 - Do not filter with blank tags.
authorArthurHoaro <arthur@hoa.ro>
Sun, 3 Jan 2016 14:29:15 +0000 (15:29 +0100)
committerArthurHoaro <arthur@hoa.ro>
Wed, 6 Jan 2016 18:53:25 +0000 (19:53 +0100)
application/LinkDB.php
index.php

index be7d9016fc1eb1d0a00cfab2d41349adcca2d9d6..1684851902d0fdc6a0aed4023bea916849f21a6d 100644 (file)
@@ -351,7 +351,7 @@ You use the community supported version of the original Shaarli project, by Seba
      */
     public function filter($type, $request, $casesensitive = false, $privateonly = false) {
         $requestFilter = is_array($request) ? implode(' ', $request) : $request;
-        return $this->linkFilter->filter($type, $requestFilter, $casesensitive, $privateonly);
+        return $this->linkFilter->filter($type, trim($requestFilter), $casesensitive, $privateonly);
     }
 
     /**
index 1664c01b6ec192d24a2a6155f651f5db3e12d1b2..2815f02e5e40e93f946051a2580da138f0744ca4 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1298,12 +1298,14 @@ function renderPage()
 
         if (isset($params['searchtags'])) {
             $tags = explode(' ', $params['searchtags']);
-            $tags=array_diff($tags, array($_GET['removetag'])); // Remove value from array $tags.
-            if (count($tags)==0) {
+            // Remove value from array $tags.
+            $tags = array_diff($tags, array($_GET['removetag']));
+            $params['searchtags'] = implode(' ',$tags);
+
+            if (empty($params['searchtags'])) {
                 unset($params['searchtags']);
-            } else {
-                $params['searchtags'] = implode(' ',$tags);
             }
+
             unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different)
         }
         header('Location: ?'.http_build_query($params));