Merge pull request #12 from muranava/main

add isset to stop undefined q error
This commit is contained in:
Pontus Horn
2021-03-14 17:23:22 +01:00
committed by GitHub

View File

@@ -28,7 +28,7 @@ class PicoSearch extends AbstractPicoPlugin
public function onRequestUrl(&$url)
{
// If form was submitted without being intercepted by JavaScript, redirect to the canonical search URL.
if (preg_match('~^(.+/)?search$~', $url) && $_GET['q']) {
if (preg_match('~^(.+/)?search$~', $url) && isset($_GET['q'])) {
header('Location: ' . $this->getPico()->getBaseUrl() . $url . '/' . urlencode($_GET['q']));
exit;
}