mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-18 11:45:14 +00:00
Fix search when search term has useless space
This commit is contained in:
parent
85065b509f
commit
6ff00315d0
2 changed files with 13 additions and 1 deletions
|
@ -615,7 +615,7 @@ class EntryController extends AbstractController
|
||||||
*/
|
*/
|
||||||
private function showEntries($type, Request $request, $page)
|
private function showEntries($type, Request $request, $page)
|
||||||
{
|
{
|
||||||
$searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : '');
|
$searchTerm = (isset($request->get('search_entry')['term']) ? trim($request->get('search_entry')['term']) : '');
|
||||||
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
|
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
|
||||||
$request->getSession()->set('prevUrl', $request->getRequestUri());
|
$request->getSession()->set('prevUrl', $request->getRequestUri());
|
||||||
|
|
||||||
|
|
|
@ -1390,6 +1390,18 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||||
|
|
||||||
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||||
|
|
||||||
|
// Add a check with useless spaces before and after the search term
|
||||||
|
$crawler = $client->request('GET', '/unread/list');
|
||||||
|
|
||||||
|
$form = $crawler->filter('form[name=search]')->form();
|
||||||
|
$data = [
|
||||||
|
'search_entry[term]' => ' title ',
|
||||||
|
];
|
||||||
|
|
||||||
|
$crawler = $client->submit($form, $data);
|
||||||
|
|
||||||
|
$this->assertCount(4, $crawler->filter($this->entryDataTestAttribute));
|
||||||
|
|
||||||
// Search on starred list
|
// Search on starred list
|
||||||
$crawler = $client->request('GET', '/starred/list');
|
$crawler = $client->request('GET', '/starred/list');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue