Skip to content

Commit 6f811ae

Browse files
committed
Additional fixes to sympa-community#841.
1 parent 182d6e7 commit 6f811ae

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/lib/Sympa/Scenario.pm

+17-4
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,9 @@ sub _compile_condition_term {
907907
return sprintf '(%s =~ %s)', $args[0], $args[1];
908908
}
909909
} elsif ($condition_key =~ /^customcondition::(\w+)$/) {
910-
return sprintf 'do_verify_custom($that, %s, %s, %s)',
911-
_compile_hashref($rule), $1, join ', ', @args;
910+
my $mod = $1;
911+
return sprintf 'do_verify_custom($that, %s, \'%s\', %s)',
912+
_compile_hashref($rule), $mod, join ', ', @args;
912913
} else {
913914
$log->syslog('err', 'Syntax error: Unknown condition %s',
914915
$condition_key);
@@ -926,8 +927,20 @@ sub _compile_hashref {
926927
', ',
927928
map {
928929
my ($k, $v) = ($_, $hashref->{$_});
929-
$v =~ s/([\\\'])/\\$1/g;
930-
sprintf "%s => '%s'", $k, $v;
930+
if (ref $v eq 'ARRAY') {
931+
$v = join(
932+
', ',
933+
map {
934+
my $i = $_;
935+
$i =~ s/([\\\'])/\\$1/g;
936+
"'$i'";
937+
} @$v
938+
);
939+
sprintf '%s => [%s]', $k, $v;
940+
} else {
941+
$v =~ s/([\\\'])/\\$1/g;
942+
sprintf "%s => '%s'", $k, $v;
943+
}
931944
} sort keys %$hashref
932945
) . '}';
933946
}

0 commit comments

Comments
 (0)