← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/bug-354 into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-354 into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/bug-354/+merge/86813

Fix for #354. Javascript generated buggy JSON in remote when sending alert.
-- 
https://code.launchpad.net/~mahfiaz/openlp/bug-354/+merge/86813
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/remotes/html/openlp.js'
--- openlp/plugins/remotes/html/openlp.js	2011-12-21 08:15:07 +0000
+++ openlp/plugins/remotes/html/openlp.js	2011-12-23 15:27:25 +0000
@@ -208,7 +208,9 @@
   },
   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 @@
   },
   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},