@@ -950,7 +950,7 @@ module.exports.CreateDB = function (parent, func) {
950950 } ) ;
951951 } else { // If not present, create the tables and indexes
952952 //not needed, just use a create db statement: const pgtools = require('pgtools');
953- DatastoreTest . query ( 'CREATE DATABASE ' + databaseName + ';' , [ ] , function ( err , res ) {
953+ DatastoreTest . query ( 'CREATE DATABASE " ' + databaseName + '" ;' , [ ] , function ( err , res ) {
954954 if ( err == null ) {
955955 // Create the tables and indexes
956956 DatastoreTest . end ( ) ;
@@ -3420,8 +3420,8 @@ module.exports.CreateDB = function (parent, func) {
34203420 // Check that we have access to pg_dump
34213421 parent . config . settings . autobackup . pgdumppath = path . normalize ( parent . config . settings . autobackup . pgdumppath ? parent . config . settings . autobackup . pgdumppath : 'pg_dump' ) ;
34223422 let cmd = '"' + parent . config . settings . autobackup . pgdumppath + '"'
3423- + ' --dbname=postgresql://' + parent . config . settings . postgres . user + ":" + parent . config . settings . postgres . password
3424- + "@" + parent . config . settings . postgres . host + ":" + parent . config . settings . postgres . port + "/" + databaseName
3423+ + ' --dbname=postgresql://' + encodeURIComponent ( parent . config . settings . postgres . user ) + ":" + encodeURIComponent ( parent . config . settings . postgres . password )
3424+ + "@" + parent . config . settings . postgres . host + ":" + parent . config . settings . postgres . port + "/" + encodeURIComponent ( databaseName )
34253425 + ' > ' + ( ( parent . platform == 'win32' ) ? '\"nul\"' : '\"/dev/null\"' ) ;
34263426 const child_process = require ( 'child_process' ) ;
34273427 child_process . exec ( cmd , { cwd : backupPath } , function ( error , stdout , stdin ) {
@@ -3614,11 +3614,11 @@ module.exports.CreateDB = function (parent, func) {
36143614 } ) ;
36153615 } else if ( obj . databaseType == DB_POSTGRESQL ) {
36163616 // Perform a PostgresDump backup
3617- const newBackupFile = databaseName + '- pgdump-' + fileSuffix + '.sql' ;
3617+ const newBackupFile = ' pgdump-' + fileSuffix + '.sql' ;
36183618 obj . newDBDumpFile = path . join ( backupPath , newBackupFile ) ;
36193619 let cmd = '"' + parent . config . settings . autobackup . pgdumppath + '"'
3620- + ' --dbname=postgresql://' + parent . config . settings . postgres . user + ":" + parent . config . settings . postgres . password
3621- + "@" + parent . config . settings . postgres . host + ":" + parent . config . settings . postgres . port + "/" + databaseName
3620+ + ' --dbname=postgresql://' + encodeURIComponent ( parent . config . settings . postgres . user ) + ":" + encodeURIComponent ( parent . config . settings . postgres . password )
3621+ + "@" + parent . config . settings . postgres . host + ":" + parent . config . settings . postgres . port + "/" + encodeURIComponent ( databaseName )
36223622 + " --file=" + obj . newDBDumpFile ;
36233623 parent . debug ( 'backup' , 'Postgresqldump cmd: ' + cmd ) ;
36243624 const child_process = require ( 'child_process' ) ;
0 commit comments