Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Searching for "foo/bar" generates an error:
Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "keys" for route "search_api_page.sv.personal" must match "[^/]++" ("foo / bar" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 194 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('search_api_page.sv.personal', Object, Array, Array) (Line: 308)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('search_api_page.sv.personal', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('search_api_page.sv.personal', Array, Array, ) (Line: 749)
Drupal\Core\Url->toString() (Line: 130)
Drupal\Core\Form\FormSubmitter->redirectForm(Object) (Line: 77)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('search_api_page_block_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('search_api_page_block_form', Object) (Line: 212)
Drupal\Core\Form\FormBuilder->getForm('Drupal\search_api_page\Form\SearchApiPageBlockForm', Array) (Line: 53)
Drupal\kau_solr\Controller\KauSolrSearchApiPageController->page(Object, 'personal', '')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 572)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 626)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment | File | Size | Author |
---|---|---|---|
#11 | 2721619.patch | 5.16 KB | borisson_ |
|
Comments
Comment #2
swentel CreditAttribution: swentel at eps & kaas for MuseScore commentedMmm yeah, there's probably not a (clean) way to get this working when clean urls is enabled, unless I add more parts to the path when generating the route.
Comment #3
mr.baileysProof of concept attached, probably needs some serieus testing, cleanup and fine-tuning, but overall it seems to work and is not too hackish. Needs review for approach.
Comment #4
sawtell CreditAttribution: sawtell commentedI don't have any experience with PathProcessors so can't comment on that specifically but the patch is working for me.
Comment #5
borisson_This looks good, but I have some nits to pick.
Needs new blank line.
Needs a class docblock. I think we can also import the InboundPathProcessorInterface to make this line < 80 chars.
I think these also need a docblock.
Needs a docblock.
This is what happens when nothing matches, right? Would it make sense to document that?
Let's give this a docblock as well.
I also think we can refactor this method to be a little bit easier. But that's interpretation/taste. Can be left alone I think.
Needs newline.
Comment #6
borisson_Do you think we should keep this as a seperate service or should we integrate this with #2794119: Wrong URL on language switcher block?
Comment #7
borisson_Fixed my own comments + added a test.
Comment #8
borisson_Rerolled.
Comment #10
borisson_This breaks the tests added in #2904203: Spaces in searchs cause AliasManager to throw errors., so we need to fix this to still pass with those tests added.
Comment #11
borisson_I fixed this, and now the previous tests also passes. This is the only significant change.
I made some other changes, such as indenting the yaml correctly, and I moved one getter out of the foreach, for some better performance. This is probably just a few ms, because otherwise this was coming from a static cache - but I guess even just a function call can make a small difference.
All we need is a +1, so we can get this in.
Comment #13
borisson_Committed this, we have a test that proves this works.