From: Mark Rada Date: Tue, 25 Aug 2009 04:59:48 +0000 (-0400) Subject: gitweb: improve snapshot error handling X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/9dba264f8c80ea663327734759f3557a5a2c7fc15071908cbd53cc2f008c12b5 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index 3009392..bc9034b 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -5191,10 +5191,10 @@ sub git_snapshot { die_error(400, "Invalid snapshot format parameter"); } elsif (!exists($known_snapshot_formats{$format})) { die_error(400, "Unknown snapshot format"); - } elsif (!grep($_ eq $format, @snapshot_fmts)) { - die_error(403, "Unsupported snapshot format"); } elsif ($known_snapshot_formats{$format}{'disabled'}) { die_error(403, "Snapshot format not allowed"); + } elsif (!grep($_ eq $format, @snapshot_fmts)) { + die_error(403, "Unsupported snapshot format"); } if (!defined $hash) {