X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=gitweb%2Fgitweb.perl;h=874023a33e9162b99bfa5b0e4038b102c129f6f1;hb=b13e3eacefc0fb6f4f89738f74ba5ef14437bed5;hp=85d64b244dead86132de8a2a980cfbfc27c86494;hpb=7fa6c90c72fb8dc8277d7cae759d5036046a5164;p=git.git diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 85d64b244..874023a33 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -85,6 +85,8 @@ our $home_link_str = "++GITWEB_HOME_LINK_STR++"; our $site_name = "++GITWEB_SITENAME++" || ($ENV{'SERVER_NAME'} || "Untitled") . " Git"; +# html snippet to include in the section of each page +our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++"; # filename of html text to include at top of each page our $site_header = "++GITWEB_SITE_HEADER++"; # html text to include at home page @@ -1440,8 +1442,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); @@ -1693,6 +1695,7 @@ sub chop_and_escape_str { my ($str) = @_; my $chopped = chop_str(@_); + $str = to_utf8($str); if ($chopped eq $str) { return esc_html($chopped); } else { @@ -2886,7 +2889,7 @@ sub filter_forks_from_projects_list { $path =~ s/\.git$//; # forks of 'repo.git' are in 'repo/' directory next if ($path =~ m!/$!); # skip non-bare repositories, e.g. 'repo/.git' next unless ($path); # skip '.git' repository: tests, git-instaweb - next unless (-d $path); # containing directory exists + next unless (-d "$projectroot/$path"); # containing directory exists $pr->{'forks'} = []; # there can be 0 or more forks of project # add to trie @@ -3879,6 +3882,11 @@ EOF print "\n"; } print_header_links($status); + + if (defined $site_html_head_string) { + print to_utf8($site_html_head_string); + } + print "\n" . "\n"; @@ -6100,7 +6108,9 @@ sub git_blame_common { -type=>"text/plain", -charset => "utf-8", -status=> "200 OK"); local $| = 1; # output autoflush - print while <$fd>; + while (my $line = <$fd>) { + print to_utf8($line); + } close $fd or print "ERROR $!\n"; @@ -7692,11 +7702,12 @@ sub git_opml { -charset => 'utf-8', -content_disposition => 'inline; filename="opml.xml"'); + my $title = esc_html($site_name); print < - $site_name OPML Export + $title OPML Export