luci-lilb-nixio: Code quality fixes

future variants could use en/decodeURIComponent

ordering is important when handling "&"

Signed-off-by: Paul Donald <newtwen@gmail.com>
This commit is contained in:
Paul Donald 2024-01-31 02:25:33 +01:00
parent 74b89027d3
commit d46da53bcd

View file

@ -5943,10 +5943,10 @@ String.prototype.htmlEncode = function()
return(this.replace(/&/mg,"&amp;").replace(/</mg,"&lt;").replace(/>/mg,"&gt;").replace(/\"/mg,"&quot;"));
}
// Convert "&amp;" to &, "&lt;" to <, "&gt;" to > and "&quot;" to "
// Convert "&lt;" to <, "&gt;" to >, "&quot;" to " and "&amp;" to & (& handled last for security reasons)
String.prototype.htmlDecode = function()
{
return(this.replace(/&amp;/mg,"&").replace(/&lt;/mg,"<").replace(/&gt;/mg,">").replace(/&quot;/mg,"\""));
return(this.replace(/&lt;/mg,"<").replace(/&gt;/mg,">").replace(/&quot;/mg,"\"").replace(/&amp;/mg,"&"));
}
// Parse a space-separated string of name:value parameters where: