From 6c1d46a0c69bf7780cab46693b39a51f4c822a67 Mon Sep 17 00:00:00 2001 From: Jawad Margieh Date: Wed, 7 Jul 2021 16:06:35 +0300 Subject: [PATCH 1/2] Support Username & passowrd containg special characters --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/service/amqp/amqp.service.ts | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b720d15..abbac49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.0.1] (2021-07-07) + +### Bug Fixes +- Support username & password with special characters. + + ## [2.0.0](https://github.com/team-supercharge/nest-amqp/compare/v1.3.0...v2.0.0) (2021-04-14) diff --git a/package.json b/package.json index 7e03185..a8d73fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@team-supercharge/nest-amqp", - "version": "2.0.0", + "version": "2.0.1", "description": "AMQP 1.0 module for Nest framework", "author": "Supercharge", "license": "MIT", diff --git a/src/service/amqp/amqp.service.ts b/src/service/amqp/amqp.service.ts index 6f4c8f9..dbf4417 100644 --- a/src/service/amqp/amqp.service.ts +++ b/src/service/amqp/amqp.service.ts @@ -54,8 +54,9 @@ export class AMQPService { logger.log('creating AMQP client'); const { throwExceptionOnConnectionError, connectionUri, ...rheaConnectionOptions } = options; - const { protocol, username, password, hostname, port } = new URL(connectionUri); - + let { protocol, username, password, hostname, port } = new URL(connectionUri); + password = decodeURIComponent(password); + username = decodeURIComponent(username); logger.log( `initializing client connection to ${JSON.stringify({ protocol, From 26dd19c186419793b48754e744a9913dcc55bcb2 Mon Sep 17 00:00:00 2001 From: Jawad Margieh Date: Wed, 7 Jul 2021 16:12:02 +0300 Subject: [PATCH 2/2] seperate const and let --- src/service/amqp/amqp.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/service/amqp/amqp.service.ts b/src/service/amqp/amqp.service.ts index dbf4417..3eb0769 100644 --- a/src/service/amqp/amqp.service.ts +++ b/src/service/amqp/amqp.service.ts @@ -54,7 +54,9 @@ export class AMQPService { logger.log('creating AMQP client'); const { throwExceptionOnConnectionError, connectionUri, ...rheaConnectionOptions } = options; - let { protocol, username, password, hostname, port } = new URL(connectionUri); + const url: URL = new URL(connectionUri); + const { protocol, hostname, port } = url; + let {username, password} = url; password = decodeURIComponent(password); username = decodeURIComponent(username); logger.log(