From f00cabe4ecd3ed6e567890fa75db222af6487195 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 8 Jun 2019 17:52:25 -0700 Subject: [PATCH] Factoids: correct edge-case mishandling of quoted arguments --- PBot/FactoidCommands.pm | 3 +-- PBot/Factoids.pm | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index da57ba53..fad3a26c 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -614,8 +614,7 @@ sub factunset { 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 - my $arglist = $self->{pbot}->{interpreter}->make_args($arguments); - my ($key) = $self->{pbot}->{interpreter}->split_args($arglist, 1); + my ($key) = $self->{pbot}->{interpreter}->split_line($arguments, 1); return $usage if not length $key; diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 64d21e89..9de9fc57 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -313,7 +313,9 @@ sub find_factoid { } else { $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; } @@ -341,7 +343,9 @@ sub find_factoid { if ($find_alias) { 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" : ""); goto NEXT_DEPTH; }