Can't create a Queue UI plugin that works for queue names with "/"

Created on 17 December 2024, 4 months ago
Updated 17 February 2025, about 2 months ago

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 β†’

Unfortunately, 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

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 in \Drupal\queue_ui\Form\InspectForm::buildForm()

Remaining tasks

User interface changes

none

API changes

none

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pwolanin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024