]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
Fix showing of path in tree view
[Gitweb] / gitweb.perl
index adfb99f87125399cb6c0f449d19d6f77948b72a7918f0edc175da5e618e14d85..a308c0a30be5e5f207d6da8bc95b3c37e8d8d0e80881b3521d409a33dcf829ab 100755 (executable)
@@ -300,6 +300,7 @@ sub evaluate_path_info {
                $pathname =~ s,^/+,,;
                if (!$pathname || substr($pathname, -1) eq "/") {
                        $action  ||= "tree";
+                       $pathname =~ s,/$,,;
                } else {
                        $action  ||= "blob_plain";
                }
@@ -1513,12 +1514,15 @@ sub git_print_page_path {
                my $fullname = '';
 
                print "<div class=\"page_path\">";
+               print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
+                             -title => '/'}, '/');
+               print " ";
                foreach my $dir (@dirname) {
-                       $fullname .= $dir . '/';
+                       $fullname .= ($fullname ? '/' : '') . $dir;
                        print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
                                                     hash_base=>$hb),
-                                     -title => $fullname}, esc_html($dir));
-                       print "/";
+                                     -title => $fullname}, esc_html($dir . '/'));
+                       print " ";
                }
                if (defined $type && $type eq 'blob') {
                        print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
@@ -1527,8 +1531,7 @@ sub git_print_page_path {
                } elsif (defined $type && $type eq 'tree') {
                        print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
                                                     hash_base=>$hb),
-                                     -title => $name}, esc_html($basename));
-                       print "/";
+                                     -title => $name}, esc_html($basename . '/'));
                } else {
                        print esc_html($basename);
                }
This page took 0.233734 seconds and 4 git commands to generate.