X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/1b2c33db144b6b7efb1b35e2b36cddffc660f493537889bf6be9accd5f2f4ea3..860386bfb01a1d9c04d867d95868f3f15cb43acfacdb2ae7d262f2ca7228de89:/gitweb.perl?ds=sidebyside diff --git a/gitweb.perl b/gitweb.perl index 33a89d5..1cfb8ae 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -1444,8 +1444,8 @@ sub validate_refname { sub to_utf8 { my $str = shift; return undef unless defined $str; - if (utf8::valid($str)) { - utf8::decode($str); + + if (utf8::is_utf8($str) || utf8::decode($str)) { return $str; } else { return decode($fallback_encoding, $str, Encode::FB_DEFAULT); @@ -2837,8 +2837,8 @@ sub git_get_projects_list { my $dir = $projects_list; # remove the trailing "/" $dir =~ s!/+$!!; - my $pfxlen = length("$projects_list"); - my $pfxdepth = ($projects_list =~ tr!/!!); + my $pfxlen = length("$dir"); + my $pfxdepth = ($dir =~ tr!/!!); # when filtering, search only given subdirectory if ($filter) { $dir .= "/$filter"; @@ -5853,7 +5853,7 @@ sub git_search_files { my $lastfile = ''; while (my $line = <$fd>) { chomp $line; - my ($file, $lno, $ltext, $binary); + my ($file, $file_href, $lno, $ltext, $binary); last if ($matches++ > 1000); if ($line =~ /^Binary file (.+) matches$/) { $file = $1; @@ -5868,10 +5868,10 @@ sub git_search_files { } else { print "