Problem/Motivation
For the queue_unique module, we added a way to prefix a queue name like "queue_unique/node_updates" and override the core queue factory to give you a queue_unique instance instead of a default instance when you ask for that from the factory. https://www.drupal.org/project/queue_unique/issues/3301657
In the latest version of this module, I get the exception without even trying to add a new plugin - just visit the listing page.
In older version of the module, if I try to make a trivial subclass of Drupal\queue_ui\Plugin\QueueUI\DatabaseQueue to be able to inspect those queue items, I get an exception on the queue listing page /admin/config/system/queue-ui
In either case, the exception comes from the router:
Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "queueName" for route "queue_ui.inspect" must match "[^/]++" ("queue_unique/node_updates" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 203 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('queue_ui.inspect', Object, Array, Array) (Line: 291)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('queue_ui.inspect', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('queue_ui.inspect', Array, Array, 1) (Line: 765)
Drupal\Core\Url->toString(1) (Line: 182)
Drupal\Core\Utility\LinkGenerator->generate(Object, Object) (Line: 95)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
...
Steps to reproduce
Proposed resolution
using rawurlencode() on the queue name before passing as a route parameter doesn't work, unfortunately.
So, find another way to encode any "/" in the queue name (or url-safe base64 encode the whole name) and then decode whever it's used, such as \Drupal\queue_ui\Form\InspectForm::buildForm()
see also: https://symfony.com/doc/current/routing.html
Remaining tasks
add test
User interface changes
none
API changes
none
Issue fork queue_ui-3494639
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3494639-b64-queue-name
changes, plain diff MR !57
- 3494639-cant-create-a
changes, plain diff MR !60
Comments
Comment #3
pwolanin commentedComment #4
pwolanin commentedI tried to pas a url-encoded queue name into the url generator as the route parameter, but that wasn't working.
I could try again, but a 100% safe approach is using a base64 encoding for the queue name. I made what I think are all the needed changes.
Comment #5
pwolanin commentedComment #7
pwolanin commentedComment #8
pwolanin commentedComment #9
pwolanin commentedI should likely extend one of the tests to add a queue with a "/" at least
Comment #10
pwolanin commentedComment #12
fjgarlin commentedJust rebasing and tidying up MRs as the namespace fix was merged in another issue.
Comment #13
pwolanin commentedI updated one of the tests so that the plugin ID (and queue name) contain a slash to validate that it works with the fix.
Comment #16
volegerI'd move this fix/change to the next major version.
Comment #18
volegerFixed thanks
Comment #19
volegerAnyone who needs that feature working now for 3.2.2, you can use this stable patch link
https://git.drupalcode.org/project/queue_ui/-/commit/45bde3430d9139ad600...
Comment #20
volegerComment #22
voleger