]> git.aero2k.de Git - urlbot-v3.git/commit
Fix NATS classifier publish dropping messages with quoted multi-word args
authorThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 11:40:11 +0000 (13:40 +0200)
committerThorsten <mail@aero2k.de>
Sat, 18 Jul 2026 11:40:11 +0000 (13:40 +0200)
commit41dff01497ebf8a95643fa64cb04e99db41adf2c
treee4984fe48babbdef50ae27f559f91fcd689ffb56
parent1361f8926185217cae7666dffc848bd9370cfddb
Fix NATS classifier publish dropping messages with quoted multi-word args

A shlex-quoted plugin argument (e.g. choose 'multi word option') produces
a routing key containing a literal space. AMQP's topic exchange tolerates
that, but NATS's whitespace-delimited wire protocol does not - the PUB
frame gets corrupted and the server silently drops the connection before
the message reaches any subscriber. Sanitize whitespace out of the
subject before publishing; the JSON payload plugins actually read from is
untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
src/distbot/common/broker_nats.py
tests/test_unit/test_broker_nats.py [new file with mode: 0644]