3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 09:58:42 +02:00

Factoids: correct edge-case mishandling of quoted arguments

This commit is contained in:
Pragmatic Software 2019-06-08 17:52:25 -07:00
parent 8a664a3ea1
commit f00cabe4ec
2 changed files with 7 additions and 4 deletions

View File

@ -614,8 +614,7 @@ sub factunset {
my ($channel, $trigger, $arguments) = $self->find_factoid_with_optional_channel($from, $args, 'factunset', $usage, 1); my ($channel, $trigger, $arguments) = $self->find_factoid_with_optional_channel($from, $args, 'factunset', $usage, 1);
return $channel if not defined $trigger; # if $trigger is not defined, $channel is an error message return $channel if not defined $trigger; # if $trigger is not defined, $channel is an error message
my $arglist = $self->{pbot}->{interpreter}->make_args($arguments); my ($key) = $self->{pbot}->{interpreter}->split_line($arguments, 1);
my ($key) = $self->{pbot}->{interpreter}->split_args($arglist, 1);
return $usage if not length $key; return $usage if not length $key;

View File

@ -313,7 +313,9 @@ sub find_factoid {
} else { } else {
$command = $1; $command = $1;
} }
($keyword, $arguments) = split /\s+/, $command, 2; my @args = $self->{pbot}->{interpreter}->split_line($command, 1);
$keyword = shift @args;
$arguments = join ' ', @args;
goto NEXT_DEPTH; goto NEXT_DEPTH;
} }
@ -341,7 +343,9 @@ sub find_factoid {
if ($find_alias) { if ($find_alias) {
my $command = $self->{factoids}->hash->{$channel}->{$trigger}->{action}; my $command = $self->{factoids}->hash->{$channel}->{$trigger}->{action};
($keyword, $arguments) = split /\s+/, $command, 2; my @args = $self->{pbot}->{interpreter}->split_line($command, 1);
$keyword = shift @args;
$arguments = join ' ', @args;
$string = $keyword . (length $arguments ? " $arguments" : ""); $string = $keyword . (length $arguments ? " $arguments" : "");
goto NEXT_DEPTH; goto NEXT_DEPTH;
} }