Fix empty dialog messages

Escape ampersands and angle brackets in some Gtk::MessageDialogs.
Closes #6306.
This commit is contained in:
Lawrence Lee
2021-08-15 12:23:29 -07:00
parent 22f89bc752
commit d3b67c1e22
7 changed files with 14 additions and 14 deletions

View File

@@ -221,7 +221,7 @@ bool confirmOverwrite (Gtk::Window& parent, const std::string& filename)
bool safe = true;
if (Glib::file_test (filename, Glib::FILE_TEST_EXISTS)) {
Glib::ustring msg_ = Glib::ustring ("<b>\"") + Glib::path_get_basename (filename) + "\": "
Glib::ustring msg_ = Glib::ustring ("<b>\"") + escapeHtmlChars(Glib::path_get_basename (filename)) + "\": "
+ M("MAIN_MSG_ALREADYEXISTS") + "</b>\n" + M("MAIN_MSG_QOVERWRITE");
Gtk::MessageDialog msgd (parent, msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);
safe = (msgd.run () == Gtk::RESPONSE_YES);
@@ -232,7 +232,7 @@ bool confirmOverwrite (Gtk::Window& parent, const std::string& filename)
void writeFailed (Gtk::Window& parent, const std::string& filename)
{
Glib::ustring msg_ = Glib::ustring::compose(M("MAIN_MSG_WRITEFAILED"), filename);
Glib::ustring msg_ = Glib::ustring::compose(M("MAIN_MSG_WRITEFAILED"), escapeHtmlChars(filename));
Gtk::MessageDialog msgd (parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}