3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 19:52:34 +01:00

validate_string: Remove unnecessary substr left over from special character scrubbing

This commit is contained in:
Pragmatic Software 2017-12-03 10:02:13 -08:00
parent 42376baf72
commit 52d3ab024b

View File

@ -11,7 +11,7 @@ sub validate_string {
$max_length = 2000 if not defined $max_length; $max_length = 2000 if not defined $max_length;
$string = substr $string, 0, $max_length unless $max_length <= 0; $string = substr $string, 0, $max_length unless $max_length <= 0;
# $string =~ s/(\P{PosixGraph})/my $ch = $1; if ($ch =~ m{[\s\x03\x02\x1d\x1f\x16\x0f]}) { $ch } else { sprintf "\\x%02X", ord $ch }/ge; # $string =~ s/(\P{PosixGraph})/my $ch = $1; if ($ch =~ m{[\s\x03\x02\x1d\x1f\x16\x0f]}) { $ch } else { sprintf "\\x%02X", ord $ch }/ge;
$string = substr $string, 0, $max_length unless $max_length <= 0; # $string = substr $string, 0, $max_length unless $max_length <= 0;
return $string; return $string;
} }