Skip to content

Commit

Permalink
fix: match insertion error when the db password contains special chars
Browse files Browse the repository at this point in the history
fix #642
  • Loading branch information
akiver committed Dec 2, 2023
1 parent 29e7254 commit b2e08ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node/database/matches/match-insertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export async function insertFromCsv<Table>({
}: InsertFromCsvOptions<Table>) {
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);
}

Expand Down

0 comments on commit b2e08ef

Please sign in to comment.