Fixes #426 - Do not filter with blank tags.

This commit is contained in:
ArthurHoaro 2016-01-03 15:29:15 +01:00
parent 822bffced8
commit 2c75f8e780
2 changed files with 7 additions and 5 deletions

View file

@ -351,7 +351,7 @@ public function getLinkFromUrl($url)
*/ */
public function filter($type, $request, $casesensitive = false, $privateonly = false) { public function filter($type, $request, $casesensitive = false, $privateonly = false) {
$requestFilter = is_array($request) ? implode(' ', $request) : $request; $requestFilter = is_array($request) ? implode(' ', $request) : $request;
return $this->linkFilter->filter($type, $requestFilter, $casesensitive, $privateonly); return $this->linkFilter->filter($type, trim($requestFilter), $casesensitive, $privateonly);
} }
/** /**

View file

@ -1298,12 +1298,14 @@ function renderPage()
if (isset($params['searchtags'])) { if (isset($params['searchtags'])) {
$tags = explode(' ', $params['searchtags']); $tags = explode(' ', $params['searchtags']);
$tags=array_diff($tags, array($_GET['removetag'])); // Remove value from array $tags. // Remove value from array $tags.
if (count($tags)==0) { $tags = array_diff($tags, array($_GET['removetag']));
$params['searchtags'] = implode(' ',$tags);
if (empty($params['searchtags'])) {
unset($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) 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)); header('Location: ?'.http_build_query($params));