Fixed settings page broken by using "%" in input fields (fixes #1516 )

This commit is contained in:
cschwinne 2021-06-30 18:21:56 +02:00
parent 8b6cc708e7
commit 7483d3b229
3 changed files with 19 additions and 4 deletions

View File

@ -2,6 +2,10 @@
### Builds after release 0.12.0
#### Build 2106302
- Fixed settings page broken by using "%" in input fields
#### Build 2106301
- Fixed a problem with disabled buttons reverting to pin 0 causing conflict

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2106301
#define VERSION 2106302
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG

View File

@ -158,13 +158,24 @@ void sappends(char stype, const char* key, char* val)
{
switch(stype)
{
case 's': //string (we can interpret val as char*)
case 's': { //string (we can interpret val as char*)
oappend("d.Sf.");
oappend(key);
oappend(".value=\"");
oappend(val);
//convert "%" to "%%" to make EspAsyncWebServer happy
char buf[130];
uint8_t len = strlen(val) +1;
uint8_t s = 0;
for (uint8_t i = 0; i < len; i++) {
buf[i+s] = val[i];
if (val[i] == '%') {
s++; buf[i+s] = '%';
}
}
oappend(buf);
oappend("\";");
break;
break; }
case 'm': //message
oappend(SET_F("d.getElementsByClassName"));
oappend(key);