Skip to content

Commit d2d2515

Browse files
committed
fix: add decodeuricomponent to parse uri encoded special characters in host, username, password and datbase keys
1 parent 1aec4fd commit d2d2515

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/connection_config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ class ConnectionConfig {
260260
static parseUrl(url) {
261261
const parsedUrl = new URL(url);
262262
const options = {
263-
host: parsedUrl.hostname,
263+
host: decodeURIComponent(parsedUrl.hostname),
264264
port: parseInt(parsedUrl.port, 10),
265-
database: parsedUrl.pathname.slice(1),
266-
user: parsedUrl.username,
267-
password: parsedUrl.password
265+
database: decodeURIComponent(parsedUrl.pathname.slice(1)),
266+
user: decodeURIComponent(parsedUrl.username),
267+
password: decodeURIComponent(parsedUrl.password),
268268
};
269269
parsedUrl.searchParams.forEach((value, key) => {
270270
try {

0 commit comments

Comments
 (0)