2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 17:26:34 +00:00

fhemweb.js: quote returned <> from modify (Forum #69138)

git-svn-id: https://svn.fhem.de/fhem/trunk@13722 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-17 11:05:48 +00:00
parent d298be4d89
commit a1fabe668a

View File

@ -600,6 +600,14 @@ FW_replaceLink(el)
$(el).css("cursor", "pointer");
}
function
FW_htmlQuote(text)
{
return text.replace(/&/g, '&amp;') // Same as in 01_FHEMWEB
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
function
FW_inlineModify() // Do not generate a new HTML page upon pressing modify
{
@ -655,16 +663,16 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
FW_cmd(FW_root+"?"+encodeURIComponent(cmd)+"&XHR=1", function(resp){
if(resp) {
resp = FW_htmlQuote(resp);
if(resp.indexOf("\n") >= 0)
resp = '<pre>'+resp+'</pre>';
return FW_okDialog(resp);
}
newDef = newDef.replace(/&/g, '&amp;') // Same as in 01_FHEMWEB
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
if(isDef) {
if(newDef.indexOf("\n") >= 0)
newDef = '<pre>'+newDef+'</pre>';
else
newDef = FW_htmlQuote(newDef);
$("div#disp").html(newDef).css("display", "");
$("div#edit").css("display", "none");
}