@matheusbsbs / matheus-bagliano / commits / dd04c428cf
Fork 0

gitweb: fix $project usage

There were some places where $project was used even if it was not defined. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Lederhofer committed Aug 6, 2006 at 13:25 UTC dd04c428cfea1d9dd7684bbd9e2919fbad051b26
1 file changed +12 -5
gitweb/gitweb.perl
+12 -5
@@ -85,7 +85,10 @@ if (defined $action) {
85 }
86
87 our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
88 -$project =~ s|^/||; $project =~ s|/$||;
88 +if (defined $project) {
89 + $project =~ s|^/||;
90 + $project =~ s|/$||;
91 +}
92 if (defined $project && $project) {
93 if (!validate_input($project)) {
94 die_error(undef, "Invalid project parameter");
@@ -874,11 +877,15 @@ sub git_header_html {
877 <title>$title</title>
878 <link rel="stylesheet" type="text/css" href="$stylesheet"/>
879 EOF
877 - print "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
878 - "$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>\n" .
879 - "</head>\n";
880 + if (defined $project) {
881 + printf('<link rel="alternate" title="%s log" '.
882 + 'href="%s" type="application/rss+xml"/>'."\n",
883 + esc_param($project),
884 + esc_param("$my_uri?p=$project;a=rss"));
885 + }
886
881 - print "<body>\n" .
887 + print "</head>\n" .
888 + "<body>\n" .
889 "<div class=\"page_header\">\n" .
890 "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
891 "<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .