git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gitweb: Fix bug in evaluate_path_info
@ 2010-10-13 11:33 Jakub Narebski
  2010-10-13 11:35 ` [PATCH 2/2] gitweb: Improve behavior for actionless path_info gitweb URLs Jakub Narebski
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Narebski @ 2010-10-13 11:33 UTC (permalink / raw)
  To: git; +Cc: Eli Barzilay

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>
---
This was detected by t9500-gitweb-standalone-no-errors test script,
but only after applying second patch in this series.

Unfortunately it is not easy to detect that gitweb generated correct
view; t9500 script only checks if Perl doesn't show any errors or
warnings.  That is why I have not added test for this issue (yet).

 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 15b5bb9..9116a0e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -780,10 +780,10 @@ sub evaluate_path_info {
 		'history',
 	);
 
-	# we want to catch
+	# we want to catch, among others
 	# [$hash_parent_base[:$file_parent]..]$hash_parent[:$file_name]
 	my ($parentrefname, $parentpathname, $refname, $pathname) =
-		($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?(.+?)(?::(.+))?$/);
+		($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?([^:]+?)?(?::(.+))?$/);
 
 	# first, analyze the 'current' part
 	if (defined $pathname) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-13 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13 11:33 [PATCH 1/2] gitweb: Fix bug in evaluate_path_info Jakub Narebski
2010-10-13 11:35 ` [PATCH 2/2] gitweb: Improve behavior for actionless path_info gitweb URLs Jakub Narebski

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).