@matheusbsbs / matheus-bagliano / commits / 7e00dc58d1
Fork 0

gitweb: Fix bug in evaluate_path_info

There was bug in parsing "project/:/file" and "project/:/" path_info URLs, with implicit HEAD as 'hash_base'. For such URLs the refname is empty, and before this fix regexp for parsing path_info fragment assumed that it is always non-empty. Refname cannot contain ':', as per 'git check-ref-format'. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Oct 13, 2010 at 13:33 UTC 7e00dc58d14a5f8ea229e5a0acf5f019028e3a40
1 file changed +2 -2
gitweb/gitweb.perl
+2 -2
@@ -780,10 +780,10 @@ sub evaluate_path_info {
780 'history',
781 );
782
783 - # we want to catch
783 + # we want to catch, among others
784 # [$hash_parent_base[:$file_parent]..]$hash_parent[:$file_name]
785 my ($parentrefname, $parentpathname, $refname, $pathname) =
786 - ($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?(.+?)(?::(.+))?$/);
786 + ($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?([^:]+?)?(?::(.+))?$/);
787
788 # first, analyze the 'current' part
789 if (defined $pathname) {