From baa9bf313edc1e4f241837f62c934fea91001b99 Mon Sep 17 00:00:00 2001 From: phani-srikar Date: Mon, 19 Aug 2024 10:17:30 -0700 Subject: [PATCH 1/2] fix: encode password to handle special chars --- .../src/sql-datatabase-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts b/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts index 61bb96dbf5..e4335a7391 100644 --- a/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts +++ b/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts @@ -260,6 +260,6 @@ export class SqlDatatabaseController { */ getConnectionUri = (engine: SqlEngine, username: string, password: string, hostname: string, port: number, dbName: string): string => { const protocol = engine === 'postgres' ? 'postgresql' : 'mysql'; - return `${protocol}://${username}:${password}@${hostname}:${port}/${dbName}`; + return `${protocol}://${username}:${encodeURIComponent(password)}@${hostname}:${port}/${dbName}`; }; } From e96acfadcdc5bd7bfade1a01e21502d554bbc86c Mon Sep 17 00:00:00 2001 From: phani-srikar Date: Mon, 19 Aug 2024 11:11:41 -0700 Subject: [PATCH 2/2] fix: encode the username as well since mysql supports spaces --- .../src/sql-datatabase-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts b/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts index e4335a7391..0e724b2464 100644 --- a/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts +++ b/packages/amplify-graphql-api-construct-tests/src/sql-datatabase-controller.ts @@ -260,6 +260,6 @@ export class SqlDatatabaseController { */ getConnectionUri = (engine: SqlEngine, username: string, password: string, hostname: string, port: number, dbName: string): string => { const protocol = engine === 'postgres' ? 'postgresql' : 'mysql'; - return `${protocol}://${username}:${encodeURIComponent(password)}@${hostname}:${port}/${dbName}`; + return `${protocol}://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${hostname}:${port}/${dbName}`; }; }