mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-24 21:29:21 +00:00
37_harmony.pm: escape some special characters in activity and device names.
see:http://forum.fhem.de/index.php/topic,14163.msg225543.html#msg225543 git-svn-id: https://svn.fhem.de/fhem/trunk@7121 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
49def50697
commit
62d19355ff
@ -155,8 +155,13 @@ harmony_idOfActivity($$;$)
|
||||
{
|
||||
my ($hash, $label, $default) = @_;
|
||||
|
||||
my $quoted_label = $label;
|
||||
#$quoted_label =~ s/\./ /g;
|
||||
$quoted_label = quotemeta($quoted_label);
|
||||
|
||||
foreach my $activity (@{$hash->{config}->{activity}}) {
|
||||
return $activity->{id} if( $activity->{label} =~ m/^$label$/ );
|
||||
return $activity->{id} if( $activity->{label} =~ m/^$quoted_label$/ );
|
||||
}
|
||||
|
||||
return $default;
|
||||
@ -189,8 +194,13 @@ harmony_idOfDevice($$;$)
|
||||
{
|
||||
my ($hash, $label, $default) = @_;
|
||||
|
||||
my $quoted_label = $label;
|
||||
#$quoted_label =~ s/\./ /g;
|
||||
$quoted_label = quotemeta($quoted_label);
|
||||
|
||||
foreach my $device (@{$hash->{config}->{device}}) {
|
||||
return $device->{id} if( $device->{label} =~ m/^$label$/ );
|
||||
return $device->{id} if( $device->{label} =~ m/^$quoted_label$/ );
|
||||
}
|
||||
|
||||
return $default;
|
||||
|
Loading…
x
Reference in New Issue
Block a user