From e94ab832eb58b07ab9e99a75ef5e24b25bba5344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Fri, 23 Dec 2011 17:23:32 +0200 Subject: [PATCH] Escape \ and " characters first, to prevent traceback when sending such an alert from remote. --- openlp/plugins/remotes/html/openlp.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js index 684c77467..8e4f1cbfc 100644 --- a/openlp/plugins/remotes/html/openlp.js +++ b/openlp/plugins/remotes/html/openlp.js @@ -208,7 +208,9 @@ window.OpenLP = { }, showAlert: function (event) { event.preventDefault(); - var text = "{\"request\": {\"text\": \"" + $("#alert-text").val() + "\"}}"; + var text = "{\"request\": {\"text\": \"" + + $("#alert-text").val().replace("\\", "\\\\").replace("\"", "\\\"") + + "\"}}"; $.getJSON( "/api/alert", {"data": text}, @@ -219,7 +221,9 @@ window.OpenLP = { }, search: function (event) { event.preventDefault(); - var text = "{\"request\": {\"text\": \"" + $("#search-text").val() + "\"}}"; + var text = "{\"request\": {\"text\": \"" + + $("#search-text").val().replace("\\", "\\\\").replace("\"", "\\\"") + + "\"}}"; $.getJSON( "/api/" + $("#search-plugin").val() + "/search", {"data": text},