git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: fix $project usage
@ 2006-08-06 11:25 Matthias Lederhofer
  0 siblings, 0 replies; only message in thread
From: Matthias Lederhofer @ 2006-08-06 11:25 UTC (permalink / raw)
  To: git

There were some places where $project was used even if it was not
defined.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
 gitweb/gitweb.perl |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d0672cd..fa9ecce 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -85,7 +85,10 @@ if (defined $action) {
 }
 
 our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
-$project =~ s|^/||; $project =~ s|/$||;
+if (defined $project) {
+	$project =~ s|^/||;
+	$project =~ s|/$||;
+}
 if (defined $project && $project) {
 	if (!validate_input($project)) {
 		die_error(undef, "Invalid project parameter");
@@ -874,11 +877,15 @@ sub git_header_html {
 <title>$title</title>
 <link rel="stylesheet" type="text/css" href="$stylesheet"/>
 EOF
-	print "<link rel=\"alternate\" title=\"" . esc_param($project) . " log\" href=\"" .
-	      "$my_uri?" . esc_param("p=$project;a=rss") . "\" type=\"application/rss+xml\"/>\n" .
-	      "</head>\n";
+	if (defined $project) {
+		printf('<link rel="alternate" title="%s log" '.
+		       '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" .
 	      "<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;\"/>" .
-- 
1.4.2.rc3.g2f52

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-06 11:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-06 11:25 [PATCH] gitweb: fix $project usage Matthias Lederhofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).