From b2e08ef04d39ef2b36b71fb12a04bad62ba69043 Mon Sep 17 00:00:00 2001 From: AkiVer Date: Sun, 3 Dec 2023 00:55:54 +0100 Subject: [PATCH] fix: match insertion error when the db password contains special chars fix #642 --- src/node/database/matches/match-insertion.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node/database/matches/match-insertion.ts b/src/node/database/matches/match-insertion.ts index 517d36c89..aad36514a 100644 --- a/src/node/database/matches/match-insertion.ts +++ b/src/node/database/matches/match-insertion.ts @@ -39,7 +39,9 @@ export async function insertFromCsv({ }: InsertFromCsvOptions
) { const { database, username, hostname, port, password } = databaseSettings; const columnNames = columns.join(','); - const command = `-c "\\copy ${tableName}(${columnNames}) FROM '${csvFilePath}' CSV DELIMITER ','" "postgresql://${username}:${password}@${hostname}:${port}/${database}"`; + const command = `-c "\\copy ${tableName}(${columnNames}) FROM '${csvFilePath}' CSV DELIMITER ','" "postgresql://${username}:${encodeURIComponent( + password, + )}@${hostname}:${port}/${database}"`; await executePsql(command); }