Fixed double quotes escaping when saving 'attributes' to config file

pull/3086/head
Javier Jaramago Fernández 5 years ago
parent c73de1bdb1
commit ee6df8ffb2

@ -1,4 +1,5 @@
#include "proxysql_config.h"
#include "re2/re2.h"
#include "proxysql.h"
#include "cpp.h"
@ -108,6 +109,10 @@ int ProxySQL_Config::Write_MySQL_Users_to_configfile(std::string& data) {
data += "mysql_users:\n(\n";
bool isNext = false;
for (auto r : sqlite_resultset->rows) {
// Prepare fields
std::string attributes { r->fields[12] };
RE2::GlobalReplace(&attributes, "\"", "\\\\\"");
if (isNext)
data += ",\n";
data += "\t{\n";
@ -123,7 +128,7 @@ int ProxySQL_Config::Write_MySQL_Users_to_configfile(std::string& data) {
addField(data, "backend", r->fields[9], "");
addField(data, "frontend", r->fields[10], "");
addField(data, "max_connections", r->fields[11], "");
addField(data, "attributes", r->fields[12]);
addField(data, "attributes", attributes.c_str());
addField(data, "comment", r->fields[13]);
data += "\t}";
isNext = true;

Loading…
Cancel
Save