@matheusbsbs / matheus-bagliano / commits / 300454feab
Fork 0

gitweb: Do not esc_html $basedir argument to git_print_tree_entry

In git_tree, rename $base variable (which is passed as $basedir argument to git_print_tree_entry) to $basedir. Do not esc_html $basedir, as it is part of file_name ('f') argument in link and not printed. Add '/' at the end only if $basedir is not empty (it is empty for top directory) and doesn't end in '/' already. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Oct 21, 2006 at 17:53 UTC 300454feaba846b6bf95625c607d7096d81d26eb
1 file changed +6 -3
gitweb/gitweb.perl
+6 -3
@@ -2783,7 +2783,7 @@ sub git_tree {
2783 my $refs = git_get_references();
2784 my $ref = format_ref_marker($refs, $hash_base);
2785 git_header_html();
2786 - my $base = "";
2786 + my $basedir = '';
2787 my ($have_blame) = gitweb_check_feature('blame');
2788 if (defined $hash_base && (my %co = parse_commit($hash_base))) {
2789 my @views_nav = ();
@@ -2811,7 +2811,10 @@ sub git_tree {
2811 print "<div class=\"title\">$hash</div>\n";
2812 }
2813 if (defined $file_name) {
2814 - $base = esc_html("$file_name/");
2814 + $basedir = $file_name;
2815 + if ($basedir ne '' && substr($basedir, -1) ne '/') {
2816 + $basedir .= '/';
2817 + }
2818 }
2819 git_print_page_path($file_name, 'tree', $hash_base);
2820 print "<div class=\"page_body\">\n";
@@ -2827,7 +2830,7 @@ sub git_tree {
2830 }
2831 $alternate ^= 1;
2832
2830 - git_print_tree_entry(\%t, $base, $hash_base, $have_blame);
2833 + git_print_tree_entry(\%t, $basedir, $hash_base, $have_blame);
2834
2835 print "</tr>\n";
2836 }