mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Fix escaping of pipes and command substitutions
This commit is contained in:
parent
9279c228dd
commit
e1028f84a2
@ -952,6 +952,7 @@ sub handle_action {
|
||||
$stuff->{no_nickoverride} = 0;
|
||||
}
|
||||
$stuff->{arguments} = "";
|
||||
$stuff->{original_arguments} = "";
|
||||
} else {
|
||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{type} eq 'text') {
|
||||
my $target = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{arguments});
|
||||
@ -974,7 +975,7 @@ sub handle_action {
|
||||
# Check if it's an alias
|
||||
if ($action =~ /^\/call\s+(.*)$/) {
|
||||
my $command = $1;
|
||||
$command .= " $stuff->{arguments}" if length $stuff->{arguments};
|
||||
$command .= " $stuff->{original_arguments}" if length $stuff->{original_arguments};
|
||||
|
||||
$stuff->{command} = $command;
|
||||
$stuff->{aliased} = 1;
|
||||
|
@ -270,9 +270,6 @@ sub interpret {
|
||||
}
|
||||
}
|
||||
|
||||
# unescape any escaped substituted commands
|
||||
$arguments =~ s/\\&\{/&{/g if defined $arguments;
|
||||
|
||||
# parse out a pipe
|
||||
if (defined $arguments && $arguments =~ m/(?<!\\)\|\s*\{\s*[^}]+\}\s*$/) {
|
||||
my ($pipe, $rest, $args) = extract_codeblock $arguments, '{}', '(?s).*?(?<!\\\\)\|\s*';
|
||||
@ -293,9 +290,6 @@ sub interpret {
|
||||
$stuff->{pipe} = $pipe;
|
||||
}
|
||||
|
||||
# unescape any escaped pipes
|
||||
$arguments =~ s/\\\|\s*\{/| {/g if defined $arguments;
|
||||
|
||||
$stuff->{nickoverride} = $stuff->{nick} if defined $stuff->{nickoverride} and lc $stuff->{nickoverride} eq 'me';
|
||||
|
||||
if ($keyword !~ /^(?:factrem|forget|set|factdel|factadd|add|factfind|find|factshow|show|forget|factdel|factset|factchange|change|msg|tell|cc|eval|u|udict|ud|actiontrigger|urban|perl|ban|mute|spinach|choose|c|lie|l|adminadd|unmute|unban)$/) {
|
||||
@ -332,6 +326,14 @@ sub interpret {
|
||||
}
|
||||
|
||||
$stuff->{keyword} = $keyword;
|
||||
$stuff->{original_arguments} = $arguments;
|
||||
|
||||
# unescape any escaped substituted commands
|
||||
$arguments =~ s/\\&\{/&{/g if defined $arguments;
|
||||
|
||||
# unescape any escaped pipes
|
||||
$arguments =~ s/\\\|\s*\{/| {/g if defined $arguments;
|
||||
|
||||
$stuff->{arguments} = $arguments;
|
||||
|
||||
return $self->SUPER::execute_all($stuff);
|
||||
|
Loading…
Reference in New Issue
Block a user