Skip to content

Commit dd8f063

Browse files
committed
fix: escape double quotes for DB_PASSWORD
1 parent de3cef5 commit dd8f063

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

__mysqldump.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ else
2929
XDB_EXPORT="> $XDB_EXPORT_FILE"
3030
fi
3131

32+
DB_PASSWORD=$(echo -n $DB_PASSWORD | sed 's/"/\\"/g')
33+
3234
CMD="\
3335
--protocol=$XDB_PROTO \
3436
--host=$XDB_HOST \
3537
--port=$XDB_PORT \
3638
--default-character-set=$XDB_DEFAULT_CHARACTER_SET \
3739
--user=$DB_USERNAME \
38-
--password=\"$DB_PASSWORD\" \
40+
--password="\"$DB_PASSWORD"\" \
3941
$DB_ARGS $DB_NAME $XDB_EXPORT"
4042

4143
echo "Alpine / MySQL Client - Exporter"

__mysqlimport.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ else
3030
XDB_IMPORT_FILE="< $XDB_IMPORT_FILE"
3131
fi
3232

33+
DB_PASSWORD=$(echo -n $DB_PASSWORD | sed 's/"/\\"/g')
34+
3335
CMD="\
3436
--protocol=$XDB_PROTO \
3537
--host=$XDB_HOST \
3638
--port=$XDB_PORT \
3739
--default-character-set=$XDB_DEFAULT_CHARACTER_SET \
3840
--user=$DB_USERNAME \
39-
--password=\"$DB_PASSWORD\" \
41+
--password="\"$DB_PASSWORD"\" \
4042
$DB_ARGS $DB_NAME $XDB_IMPORT_FILE"
4143

4244
echo "Alpine / MySQL Client - Importer"

0 commit comments

Comments
 (0)