gitweb: improve snapshot error handling
PATCH v2 1/3 gitweb: improve snapshot error handling
I reworded the message to be more specific about what code was being changed.
Signature · 17 lines
Mark A Rada (ferrous26) [email protected] --->8--- The last check in the second block of checks in the &git_snapshot routine is never executed because the second last check is a superset of the last check. This change will 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]> --- gitweb/gitweb.perl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +2 -2
@@ -5174,10 +5174,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) {
Signature · 1 line
1.6.4