Skip to content

Commit 34b31a8

Browse files
ferrous26gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cbdefb5 commit 34b31a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5175,10 +5175,10 @@ sub git_snapshot {
51755175
die_error(400, "Invalid snapshot format parameter");
51765176
} elsif (!exists($known_snapshot_formats{$format})) {
51775177
die_error(400, "Unknown snapshot format");
5178-
} elsif (!grep($_ eq $format, @snapshot_fmts)) {
5179-
die_error(403, "Unsupported snapshot format");
51805178
} elsif ($known_snapshot_formats{$format}{'disabled'}) {
51815179
die_error(403, "Snapshot format not allowed");
5180+
} elsif (!grep($_ eq $format, @snapshot_fmts)) {
5181+
die_error(403, "Unsupported snapshot format");
51825182
}
51835183

51845184
if (!defined $hash) {

0 commit comments

Comments
 (0)