Skip to content

Commit

Permalink
fix(rabbitmq): allow more valid vhost names in assertRabbitMqUri
Browse files Browse the repository at this point in the history
fix #880
  • Loading branch information
PavelPashov authored Nov 14, 2024
1 parent c47cc5b commit 6ca2d16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/rabbitmq/src/amqp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function matchesRoutingKey(
}

const rabbitMQRegex =
/^amqps?:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/[^\/]*)?$/;
/^amqps?:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/.*)?$/;

/**
* Validates a rabbitmq uri
Expand Down
2 changes: 2 additions & 0 deletions packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 6ca2d16

Please sign in to comment.