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>
This commit is contained in:
Matthias Lederhofer 2006-08-06 13:25:41 +02:00 committed by Junio C Hamano
parent 1568515d5b
commit dd04c428cf

View File

@ -85,7 +85,10 @@ if (defined $action) {
} }
our $project = ($cgi->param('p') || $ENV{'PATH_INFO'}); our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
$project =~ s|^/||; $project =~ s|/$||; if (defined $project) {
$project =~ s|^/||;
$project =~ s|/$||;
}
if (defined $project && $project) { if (defined $project && $project) {
if (!validate_input($project)) { if (!validate_input($project)) {
die_error(undef, "Invalid project parameter"); die_error(undef, "Invalid project parameter");
@ -874,11 +877,15 @@ sub git_header_html {
<title>$title</title> <title>$title</title>
<link rel="stylesheet" type="text/css" href="$stylesheet"/> <link rel="stylesheet" type="text/css" href="$stylesheet"/>
EOF EOF
print "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" . if (defined $project) {
"$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>\n" . printf('<link rel="alternate" title="%s log" '.
"</head>\n"; 'href="%s" type="application/rss+xml"/>'."\n",
esc_param($project),
esc_param("$my_uri?p=$project;a=rss"));
}
print "<body>\n" . print "</head>\n" .
"<body>\n" .
"<div class=\"page_header\">\n" . "<div class=\"page_header\">\n" .
"<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" . "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
"<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" . "<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .