@matheusbsbs / matheus-bagliano / commits / 34b31a8d5f
Fork 0

gitweb: improve snapshot error handling

The last check in the second block of checks in the &git_snapshot routine is never executed because the second to last check is a superset of the last check. Switch the order of the last two checks. It has the advantage of giving clients a more specific reason why they cannot get a snapshot format if the format they have chosen is disabled. Signed-off-by: Mark Rada <marada@uwaterloo.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mark Rada committed Aug 25, 2009 at 00:59 UTC 34b31a8d5f48283ec3039777b24706585b4f9d41
1 file changed +2 -2
gitweb/gitweb.perl
+2 -2
@@ -5175,10 +5175,10 @@ sub git_snapshot {
5175 die_error(400, "Invalid snapshot format parameter");
5176 } elsif (!exists($known_snapshot_formats{$format})) {
5177 die_error(400, "Unknown snapshot format");
5178 - } elsif (!grep($_ eq $format, @snapshot_fmts)) {
5179 - die_error(403, "Unsupported snapshot format");
5178 } elsif ($known_snapshot_formats{$format}{'disabled'}) {
5179 die_error(403, "Snapshot format not allowed");
5180 + } elsif (!grep($_ eq $format, @snapshot_fmts)) {
5181 + die_error(403, "Unsupported snapshot format");
5182 }
5183
5184 if (!defined $hash) {