3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

ValidateString: localize $@

This commit is contained in:
Pragmatic Software 2020-02-16 15:55:48 -08:00
parent d60270192a
commit eb94c566b9

View File

@ -17,6 +17,7 @@ sub validate_string {
return $string if not defined $string or not length $string;
$max_length = 1024 * 8 if not defined $max_length;
local $@;
eval {
my $h = decode_json($string);
foreach my $k (keys %$h) { $h->{$k} = substr $h->{$k}, 0, $max_length unless $max_length <= 0; }