diff options
author | Karl Williamson <khw@cpan.org> | 2022-02-16 19:23:35 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-02-16 19:31:20 -0700 |
commit | 91055b9d3024e579828bf691facaa94aa1aa74f3 (patch) | |
tree | c9ad2bec520412324f2be5d341ddd749196409b8 | |
parent | 39e50deee0a68655f5389f185655cf21baff612c (diff) | |
download | perl-91055b9d3024e579828bf691facaa94aa1aa74f3.tar.gz |
podcheck: Make sure digest gets a byte string
Digest only accepts bytes; this makes sure it doesn't get UTF-8 encoded
characters.
-rw-r--r-- | t/porting/podcheck.t | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t index 0f2f4735ac..22abfba8c0 100644 --- a/t/porting/podcheck.t +++ b/t/porting/podcheck.t @@ -1635,7 +1635,9 @@ sub is_pod_file { | $only_for_interior_links_re /x) { - $digest->add($contents); + my $byte_contents = $contents; + utf8::encode($byte_contents); + $digest->add($byte_contents); # Doesn't handle Unicode $digests{$filename} = $digest->digest; # lib files aren't analyzed if they are duplicates of files copied @@ -1805,7 +1807,9 @@ foreach my $filename (@files) { # If the return is undef, it means that $filename was a transitory # file; skip it. next FILE unless defined $contents; - $digest->add($contents); + my $byte_contents = $contents; + utf8::encode($byte_contents); + $digest->add($byte_contents); # Doesn't handle Unicode $id = $digest->digest; } |