edit_db_from_gui: impove windows paths escaping closed #217

This commit is contained in:
Boris Yumankulov 2025-01-13 00:41:22 +05:00
parent e40c4e56d1
commit df3f6de16f
No known key found for this signature in database
GPG Key ID: 14B4A5673FD39C76

@ -2891,6 +2891,10 @@ edit_db_from_gui () {
elif [[ $proxy_mod_db =~ (${translations[Enabled]}|${translations[Enable]}) ]] ; then
proxy_mod_db=enabled
fi
# Escaping backslashes and quotes for Windows paths
proxy_mod_db=$(echo "$proxy_mod_db" | sed 's/\\/\\\\\\\\/g; s/"/\\"/g')
if [[ $(<"${PORTWINE_DB_FILE}") =~ export\ ${mod_db}= ]]
then sed -i "s|export ${mod_db}=.*|export ${mod_db}=\"$proxy_mod_db\"|g" "${PORTWINE_DB_FILE}"
else echo "export ${mod_db}=\"$proxy_mod_db\"" >> "${PORTWINE_DB_FILE}"