2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhemweb.js: avoid crash on buggy attribute names (Forum #116235)

git-svn-id: https://svn.fhem.de/fhem/trunk@23262 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-11-30 09:19:48 +00:00
parent 212c02c31c
commit 4bc1553518
2 changed files with 10 additions and 7 deletions

View File

@ -1535,8 +1535,8 @@ FW_doDetail($)
sort map { $_ =~ s/ /#/g ;$_} keys %FW_rooms);
my $groupList = "multiple,".join(",",
sort map { $_ =~ s/ /#/g ;$_} keys %FW_groups);
$attrList =~ s/room /room:$roomList /;
$attrList =~ s/group /group:$groupList /;
$attrList =~ s/\broom\b/room:$roomList/;
$attrList =~ s/\bgroup\b/group:$groupList/;
$attrList = FW_widgetOverride($d, $attrList);
$attrList =~ s/\\/\\\\/g;
$attrList =~ s/'/\\'/g;

View File

@ -307,12 +307,15 @@ FW_jqueryReadyFn()
$("#content")
.append("<div id='workbench' style='display:none'></div>");
$("#content > #workbench").html(data);
var mtype = $("#content > #workbench a[name]").attr("name"), aTag;
if(mtype)
aTag = $("#content > #workbench").find("a[name="+mtype+val+"]");
if(!$(aTag).length) // old style syntax without type
aTag = $("#content > #workbench").find("a[name="+val+"]");
if(mtype) {
var mv = (mtype+val).replaceAll(/[^a-z0-9_]/ig,'_')
aTag = $("#content > #workbench").find("a[name="+mv+"]");
}
if(!$(aTag).length) { // old style syntax without type
var v = (val).replaceAll(/[^a-z0-9_]/ig,'_')
aTag = $("#content > #workbench").find("a[name="+v+"]");
}
if($(aTag).length) {
var liTag = $(aTag).next("li");
if(!$(liTag).length)