From: Jiří Setnička Date: Sat, 3 Nov 2018 19:32:20 +0000 (+0100) Subject: Fix hashing of non-ASCII file names X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ab6456d2b88575e5bb0a790e6a9dd48d77a7d6f0;p=gallery.git Fix hashing of non-ASCII file names --- diff --git a/lib/UCW/Gallery/Hashes.pm b/lib/UCW/Gallery/Hashes.pm index 233fabb..f27241f 100644 --- a/lib/UCW/Gallery/Hashes.pm +++ b/lib/UCW/Gallery/Hashes.pm @@ -7,6 +7,7 @@ use common::sense; use File::stat (); use Digest::SHA; +use Encode; sub new { my ($class, $gal) = @_; @@ -37,7 +38,7 @@ sub hash_image { my $st = File::stat::stat($path) or die "Cannot access $path: $!\n"; my $key_text = join(":", $path, $st->dev, $st->ino, $st->mtime); - my $key = Digest::SHA->sha1_base64($key_text); + my $key = Digest::SHA->sha1_base64(Encode::encode_utf8($key_text)); if (!exists $cache->{$key}) { my $sha = Digest::SHA->new(1);