|
@@ -263,6 +263,7 @@ private:
|
|
|
if (std::visit([](auto const & v) { return v.empty(); }, message)) {
|
|
if (std::visit([](auto const & v) { return v.empty(); }, message)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ std::visit([](auto &msg) { sanitize(msg); }, message);
|
|
|
results_[where][schema_path].errors.emplace(name, std::move(message));
|
|
results_[where][schema_path].errors.emplace(name, std::move(message));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -280,7 +281,20 @@ private:
|
|
|
if (std::visit([](auto const & v) { return v.empty(); }, message)) {
|
|
if (std::visit([](auto const & v) { return v.empty(); }, message)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ std::visit([](auto &msg) { sanitize(msg); }, message);
|
|
|
results_[where][schema_path].annotations.emplace(name, std::move(message));
|
|
results_[where][schema_path].annotations.emplace(name, std::move(message));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ static void sanitize(std::string &message) {
|
|
|
|
|
+ for (auto it = message.begin(); it != message.end(); ++it) {
|
|
|
|
|
+ if (*it == '"' || *it == '\\') {
|
|
|
|
|
+ it = ++message.insert(it, '\\');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ static void sanitize(std::vector<std::string> &message) {
|
|
|
|
|
+ std::ranges::for_each(message, [](std::string &val) { sanitize(val); });
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|