diff --git a/packages/rabbitmq/src/amqp/utils.ts b/packages/rabbitmq/src/amqp/utils.ts index b3301095c..792608fb2 100644 --- a/packages/rabbitmq/src/amqp/utils.ts +++ b/packages/rabbitmq/src/amqp/utils.ts @@ -29,7 +29,7 @@ export function matchesRoutingKey( } const rabbitMQRegex = - /^amqps?:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/[^\/]*)?$/; + /^amqps?:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/.*)?$/; /** * Validates a rabbitmq uri diff --git a/packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts b/packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts index 4bf17e7de..3f6f3e3c5 100644 --- a/packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts +++ b/packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts @@ -72,6 +72,8 @@ describe(matchesRoutingKey.name, () => { 'amqps://rabbitmq:rabbitmq@localhost:2345', 'amqp://rabbitmq:rabbitmq@localhost:3456/', 'amqps://rabbitmq:rabbitmq@localhost:4567/', + 'amqps://rabbitmq:rabbitmq@localhost:4567/vhost', + 'amqps://rabbitmq:rabbitmq@localhost:4567/v/h(o&s*t_', ]), ).not.toThrowError(); });