X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/29dc83657091a135d7aef4e7b7c6d9541c75795655905176f80431e7996e6701..da36a523ef7eeb487c7ea5ccf8eaa34572d1e2b01f28ae291d02b4c60816490c:/gitweb.cgi diff --git a/gitweb.cgi b/gitweb.cgi index 9fa1f09..e46e509 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -12,17 +12,19 @@ use warnings; use CGI qw(:standard :escapeHTML -nosticky); use CGI::Util qw(unescape); use CGI::Carp qw(fatalsToBrowser); +use Encode; use Fcntl ':mode'; +binmode STDOUT, ':utf8'; my $cgi = new CGI; -my $version = "248"; +my $version = "253"; my $my_url = $cgi->url(); my $my_uri = $cgi->url(-absolute => 1); -my $rss_link = ""; +my $rss_link = ""; # absolute fs-path which will be prepended to the project path #my $projectroot = "/pub/scm"; -my $projectroot = "/home/kay/public_html/pub/scm"; +my $projectroot = "/home/kay/public_html/pub/scm"; # location of the git-core binaries my $gitbin = "/usr/bin"; @@ -37,8 +39,8 @@ my $home_link = $my_uri; my $home_text = "indextext.html"; # source of projects list -#my $projects_list = $projectroot; -my $projects_list = "index/index.aux"; +#my $projects_list = $projectroot; +my $projects_list = "index/index.aux"; # input validation and dispatch my $action = $cgi->param('a'); @@ -78,8 +80,8 @@ if (defined $project) { undef $project; die_error(undef, "No such project."); } - $rss_link = ""; + $rss_link = ""; $ENV{'GIT_DIR'} = "$projectroot/$project"; } else { git_project_list(); @@ -144,7 +146,7 @@ sub validate_input { if ($input =~ m/(^|\/)(|\.|\.\.)($|\/)/) { return undef; } - if ($input =~ m/[^a-zA-Z0-9_\.\/\-\+\#\~]/) { + if ($input =~ m/[^a-zA-Z0-9_ \.\/\-\+\#\~]/) { return undef; } return $input; @@ -207,10 +209,17 @@ if (!defined $action || $action eq "summary") { exit; } -sub esc { +sub esc_url { my $str = shift; + $str =~ s/\+/%2B/g; $str =~ s/ /\+/g; - $str =~ s/\+/%2b/g; + return $str; +} + +sub esc_html { + my $str = shift; + $str = decode("utf8", $str, Encode::FB_DEFAULT); + $str = escapeHTML($str); return $str; } @@ -294,11 +303,11 @@ a.rss_logo:hover { background-color:#ee5500; } EOF print "