aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-03-20 15:24:23 -0700
committerJunio C Hamano <gitster@pobox.com>2012-03-20 15:24:23 -0700
commitbd193f46b70fd3f8a55e2a8dcbb1fb2b4eec13d6 (patch)
tree2761d246f3e66b31669866e70e3fb07c779a6693
parente521850bfd4aa79632c99293a39dad56bcaa4143 (diff)
parent18ab83e8568878edc3f6680ebdf439ccaa5bf5db (diff)
downloadgit-bd193f46b70fd3f8a55e2a8dcbb1fb2b4eec13d6.tar.gz
git-bd193f46b70fd3f8a55e2a8dcbb1fb2b4eec13d6.tar.xz
Merge branch 'jn/gitweb-unspecified-action' into maint-1.7.8
* jn/gitweb-unspecified-action: gitweb: Fix actionless dispatch for non-existent objects
-rwxr-xr-xgitweb/gitweb.perl4
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh8
2 files changed, 11 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 874023a33..6cf38853b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1122,8 +1122,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 {
@@ -2364,7 +2366,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 53297156a..94365bb00 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -404,6 +404,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"'