Skip to content

Commit fb772a5

Browse files
committed
fix: escape mongo uri on dump command
1 parent 523d899 commit fb772a5

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

api/src/dump.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ export const dump = async (dumpKey: string, _name?: string) => {
5757
const mongoUrl = new URL(config.mongo.url)
5858
mongoUrl.searchParams.set('readPreference', config.mongo.readPreference)
5959
mongoUrl.pathname = '/' + db
60-
let cmd = `mongodump --gzip --archive=${tmpPath}`
60+
let cmd = `mongodump --uri "${mongoUrl.href}" --gzip --archive=${tmpPath}`
6161
if (config.mongo.dumpParams && config.mongo.dumpParams[db]) {
6262
cmd += ` ${config.mongo.dumpParams[db]}`
6363
}
64-
cmd += ` --uri ${mongoUrl.href}`
6564
await exec(config.mongo.cmdTmpl.replace('CMD', cmd))
6665
debug('dump finished, split archive')
6766
await splitArchive({ tmpPath, name: `mongo-${db}.gz` }, name)

0 commit comments

Comments
 (0)