Skip to content
Snippets Groups Projects
Commit e9f47d4f authored by Demian Katz's avatar Demian Katz
Browse files

Smarter handling of unexpected Combined/SearchBox params.

parent 12383d7f
No related merge requests found
......@@ -244,7 +244,14 @@ class CombinedController extends AbstractSearch
$lookfor = $this->params()->fromQuery('lookfor');
return $this->redirect()->toUrl($target . urlencode($lookfor));
default:
throw new \Exception('Unexpected search type.');
// If parameters are completely missing, just redirect to home instead
// of throwing an error; this is possibly a misbehaving crawler that
// followed the SearchBox URL without passing any parameters.
if (empty($type) && empty($target)) {
return $this->redirect()->toRoute('home');
}
// If we have a weird value here, report it as an Exception:
throw new \Exception('Unexpected search type: "' . $type . '".');
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment