diff options
author | Jakub Narebski <jnareb@gmail.com> | 2012-01-07 11:47:38 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-09 13:30:59 -0800 |
commit | 18ab83e8568878edc3f6680ebdf439ccaa5bf5db (patch) | |
tree | 9d071ef5137760a9abea2f986071af5f3779e33e /gitweb | |
parent | 5f4d133fca7eb3cb750f056a6fd0281ba06cd12f (diff) | |
download | git-18ab83e8568878edc3f6680ebdf439ccaa5bf5db.tar.gz |
gitweb: Fix actionless dispatch for non-existent objectsjn/gitweb-unspecified-action
When gitweb URL does not provide action explicitly, e.g.
http://git.example.org/repo.git/branch
dispatch() tries to guess action (view to be used) based on remaining
parameters. Among others it is based on the type of requested object,
which gave problems when asking for non-existent branch or file (for
example misspelt name).
Now undefined $action from dispatch() should not result in problems.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rwxr-xr-x | gitweb/gitweb.perl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 874023a33e..6cf38853b5 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 |