openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #14561
[Merge] lp:~mahfiaz/openlp/bug-908226 into lp:openlp
mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-908226 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
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/97127
Fixes traceback when sending # or ; from web remote search or alert field.
--
https://code.launchpad.net/~mahfiaz/openlp/bug-908226/+merge/97127
Your team OpenLP Core is requested to review the proposed merge of lp:~mahfiaz/openlp/bug-908226 into 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 01:04:19 +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) {
+ string = string.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")
+ return string.replace(/#/g, "\\u0023").replace(/;/g, "\\u003B")
}
}
// Service Manager
Follow ups