COAP gateway does not pick up client ID from query parameters

When publishing to a topic via the COAP protocol, the client ID in the query parameters (if provided) is ignored and a random client ID is generated instead. According to the documentation (CoAP Gateway | EMQX 5.0 Documentation) this is not the expected behaviour. The retain query parameter does work, so the query string is being parsed correctly up to some point.
Tested on a EMQX 5.1.1 docker instance running on a Ubuntu host.

Please advise on how to extract this query parameter from COAP messages.

See [CoAP] Where the clientid query parameter is not extracted in Connectionless Mode. A random client ID is generated instead · Issue #11342 · emqx/emqx · GitHub.