From 7dca5a36f34c0b0b92d4bd5a38c4846faac5e65d Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Tue, 2 Dec 2014 21:48:49 +0000 Subject: [PATCH] 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/fhem@7121 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/37_harmony.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/FHEM/37_harmony.pm b/FHEM/37_harmony.pm index 97d4592f9..e2ebc540a 100644 --- a/FHEM/37_harmony.pm +++ b/FHEM/37_harmony.pm @@ -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;