]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: improve snapshot error handling
authorMark Rada <redacted>
Tue, 25 Aug 2009 04:59:48 +0000 (00:59 -0400)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:39 +0000 (00:50 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 3009392748ef4df1224387c1e89d42217eff32cd84e53631385df5d642d4c6af..bc9034b3ebbcfd4d390301811c4a4641618a9afea25d0084eb0dee507b4850af 100755 (executable)
@@ -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) {
This page took 0.029857 seconds and 4 git commands to generate.