Skip to content

Commit

Permalink
fix: single quotes not properly escaped for random generated content
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Feb 26, 2023
1 parent 313e740 commit 629ce63
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/ipc-handlers/tables.ts
Expand Up @@ -352,7 +352,18 @@ export default (connections: {[key: string]: antares.Client}) => {
if (typeof fakeValue === 'string') {
if (params.row[key].length)
fakeValue = fakeValue.substring(0, params.row[key].length);
fakeValue = `'${sqlEscaper(fakeValue)}'`;

switch (connections[params.uid]._client) {
case 'mysql':
case 'maria':
fakeValue = `'${sqlEscaper(fakeValue)}'`;
break;
case 'pg':
case 'sqlite':
case 'firebird':
fakeValue = `'${fakeValue.replaceAll('\'', '\'\'')}'`;
break;
}
}
else if ([...DATE, ...DATETIME].includes(type))
fakeValue = `'${moment(fakeValue).format('YYYY-MM-DD HH:mm:ss.SSSSSS')}'`;
Expand Down

0 comments on commit 629ce63

Please sign in to comment.