mirror of https://github.com/arendst/Tasmota.git
Merge pull request #10965 from s-hadinger/zigbee_escape_html
Zigbee ensure HTML encoding
This commit is contained in:
commit
0e1ce79741
|
@ -142,6 +142,15 @@ bool Z_Mapper::addEdge(const Z_Mapper_Edge & edge2) {
|
|||
return true;
|
||||
}
|
||||
|
||||
String EscapeHTMLString(const char *s_P) {
|
||||
String s((const __FlashStringHelper*) s_P);
|
||||
s.replace(F("&"), F("&"));
|
||||
s.replace(F("\""), F("""));
|
||||
s.replace(F("<"), F("<"));
|
||||
s.replace(F(">"), F(">"));
|
||||
return s;
|
||||
}
|
||||
|
||||
void Z_Mapper::dumpInternals(void) const {
|
||||
WSContentSend_P(PSTR("nodes:[" "{id:\"0x0000\",label:\"Coordinator\",group:\"o\",title:\"0x0000\"}"));
|
||||
for (const auto & device : zigbee_devices.getDevices()) {
|
||||
|
@ -150,7 +159,7 @@ void Z_Mapper::dumpInternals(void) const {
|
|||
|
||||
const char *fname = device.friendlyName;
|
||||
if (fname != nullptr) {
|
||||
WSContentSend_P(PSTR("%s"), fname);
|
||||
WSContentSend_P(PSTR("%s"), EscapeJSONString(fname).c_str());
|
||||
} else {
|
||||
WSContentSend_P(PSTR("0x%04X"), device.shortaddr);
|
||||
}
|
||||
|
|
|
@ -1960,9 +1960,9 @@ void ZigbeeShow(bool json)
|
|||
|
||||
WSContentSend_PD(msg[ZB_WEB_STATUS_LINE],
|
||||
shortaddr,
|
||||
device.modelId ? device.modelId : "",
|
||||
device.manufacturerId ? device.manufacturerId : "",
|
||||
name, sbatt, slqi);
|
||||
device.modelId ? EscapeHTMLString(device.modelId).c_str() : "",
|
||||
device.manufacturerId ? EscapeHTMLString(device.manufacturerId).c_str() : "",
|
||||
EscapeHTMLString(name).c_str(), sbatt, slqi);
|
||||
|
||||
if(device.validLqi()) {
|
||||
for(uint32_t j = 0; j < 4; ++j) {
|
||||
|
|
Loading…
Reference in New Issue