diff options
| -rwxr-xr-x | gitweb/gitweb.perl | 4 | ||||
| -rwxr-xr-x | t/t9500-gitweb-standalone-no-errors.sh | 8 | 
2 files changed, 11 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index abb5a79afc..9cf7e714a9 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1123,8 +1123,10 @@ sub dispatch {  	if (!defined $action) {  		if (defined $hash) {  			$action = git_get_type($hash); +			$action or die_error(404, "Object does not exist");  		} elsif (defined $hash_base && defined $file_name) {  			$action = git_get_type("$hash_base:$file_name"); +			$action or die_error(404, "File or directory does not exist");  		} elsif (defined $project) {  			$action = 'summary';  		} else { @@ -2391,7 +2393,7 @@ sub get_feed_info {  	return unless (defined $project);  	# some views should link to OPML, or to generic project feed,  	# or don't have specific feed yet (so they should use generic) -	return if ($action =~ /^(?:tags|heads|forks|tag|search)$/x); +	return if (!$action || $action =~ /^(?:tags|heads|forks|tag|search)$/x);  	my $branch;  	# branches refs uses 'refs/heads/' prefix (fullname) to differentiate diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index ab24917812..0f771c673d 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -475,6 +475,14 @@ test_expect_success \  	'gitweb_run "" "/.git/master:foo/"'  test_expect_success \ +	'path_info: project/branch (non-existent)' \ +	'gitweb_run "" "/.git/non-existent"' + +test_expect_success \ +	'path_info: project/branch:filename (non-existent branch)' \ +	'gitweb_run "" "/.git/non-existent:non-existent"' + +test_expect_success \  	'path_info: project/branch:file (non-existent)' \  	'gitweb_run "" "/.git/master:non-existent"'  | 
