openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #14573
[Merge] lp:~mahfiaz/openlp/bug-908226 into lp:openlp
mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-908226 into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Related bugs:
Bug #908226 in OpenLP: "Traceback when sending # or ; character from remote search or alert field"
https://bugs.launchpad.net/openlp/+bug/908226
For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/bug-908226/+merge/97175
Fixes traceback when sending # or ; from web remote search or alert field.
--
https://code.launchpad.net/~mahfiaz/openlp/bug-908226/+merge/97175
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-23 16:03:37 +0000
+++ openlp/plugins/remotes/html/openlp.js 2012-03-13 10:14:18 +0000
@@ -208,9 +208,8 @@
},
showAlert: function (event) {
event.preventDefault();
- var text = "{\"request\": {\"text\": \"" +
- $("#alert-text").val().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") +
- "\"}}";
+ var alert = OpenLP.escapeString($("#alert-text").val())
+ var text = "{\"request\": {\"text\": \"" + alert + "\"}}";
$.getJSON(
"/api/alert",
{"data": text},
@@ -221,9 +220,8 @@
},
search: function (event) {
event.preventDefault();
- var text = "{\"request\": {\"text\": \"" +
- $("#search-text").val().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") +
- "\"}}";
+ var query = OpenLP.escapeString($("#search-text").val())
+ var text = "{\"request\": {\"text\": \"" + query + "\"}}";
$.getJSON(
"/api/" + $("#search-plugin").val() + "/search",
{"data": text},
@@ -280,6 +278,10 @@
);
$("#options").dialog("close");
$.mobile.changePage("#service-manager");
+ },
+ escapeString: function (string) {
+ return string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(
+ /#/g, "%23").replace(/;/g, "%3B").replace(/\+/g, "%2B")
}
}
// Service Manager
Follow ups