Thread (2 messages) 2 messages, 2 authors, 2016-06-15

[PATCH] Re:gitweb: add readme to overview page

flat view
STALE3777d

From: Heinrich Schuchardt <hidden>
Date: 2016-06-15 22:55:14
Subsystem: the rest · Maintainer: Linus Torvalds

In this version of the patch the formatting has been corrected.

Warnings for double / in filenames are avoided.

Signed-off-by: Heinrich Schuchardt <redacted>

---
 gitweb/gitweb.perl |   12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 10ed9e5..699ffac 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6369,6 +6369,18 @@ sub git_project_list {
 	}
 
 	git_project_search_form($searchtext, $search_use_regexp);
+	# If XSS prevention is on, we don't include README.html.
+	# TODO: Allow a readme in some safe format.
+	my $path = "";
+	if (defined $project_filter) {
+		$path = "/$project_filter";
+	}
+	if (!$prevent_xss && -s "$projectroot$path/README.html") {
+		print "<div class=\"title\">readme</div>\n" .
+			"<div class=\"readme\">\n";
+		insert_file("$projectroot$path/README.html");
+		print "\n</div>\n"; # class="readme"
+	}
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help