forked from openlp/openlp
Escape \ and " characters first, to prevent traceback when sending such an alert from remote.
This commit is contained in:
parent
7f6edda463
commit
e94ab832eb
@ -208,7 +208,9 @@ window.OpenLP = {
|
|||||||
},
|
},
|
||||||
showAlert: function (event) {
|
showAlert: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var text = "{\"request\": {\"text\": \"" + $("#alert-text").val() + "\"}}";
|
var text = "{\"request\": {\"text\": \"" +
|
||||||
|
$("#alert-text").val().replace("\\", "\\\\").replace("\"", "\\\"") +
|
||||||
|
"\"}}";
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
"/api/alert",
|
"/api/alert",
|
||||||
{"data": text},
|
{"data": text},
|
||||||
@ -219,7 +221,9 @@ window.OpenLP = {
|
|||||||
},
|
},
|
||||||
search: function (event) {
|
search: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var text = "{\"request\": {\"text\": \"" + $("#search-text").val() + "\"}}";
|
var text = "{\"request\": {\"text\": \"" +
|
||||||
|
$("#search-text").val().replace("\\", "\\\\").replace("\"", "\\\"") +
|
||||||
|
"\"}}";
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
"/api/" + $("#search-plugin").val() + "/search",
|
"/api/" + $("#search-plugin").val() + "/search",
|
||||||
{"data": text},
|
{"data": text},
|
||||||
|
Loading…
Reference in New Issue
Block a user