{"thread":{"id":"20727","subject":"[PATCH v2 1/3] gitweb: improve snapshot error handling","startedAt":"2009-08-25T04:59:48Z","lastAt":"2009-08-25T04:59:48Z","messageCount":1,"participants":["Mark Rada"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"121705","messageId":"4A936FC4.1070001@mailservices.uwaterloo.ca","threadId":"20727","inReplyTo":null,"subject":"[PATCH v2 1/3] gitweb: improve snapshot error handling","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2009-08-25T04:59:48Z","receivedAt":"2009-08-25T04:59:48Z","isPatch":true,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"I reworded the message to be more specific about what code was\nbeing changed.\n\n-- \nMark A Rada (ferrous26)\nmarada@uwaterloo.ca\n\n\n--->8---\nThe last check in the second block of checks in the &git_snapshot\nroutine is never executed because the second last check is a superset\nof the last check.\n\nThis change will switch the order of the last two checks. It has the\nadvantage of giving clients a more specific reason why they cannot get\na snapshot format if the format they have chosen is disabled.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\n---\n gitweb/gitweb.perl |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 4a42f61..7068db2 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -5174,10 +5174,10 @@ sub git_snapshot {\n \t\tdie_error(400, \"Invalid snapshot format parameter\");\n \t} elsif (!exists($known_snapshot_formats{$format})) {\n \t\tdie_error(400, \"Unknown snapshot format\");\n-\t} elsif (!grep($_ eq $format, @snapshot_fmts)) {\n-\t\tdie_error(403, \"Unsupported snapshot format\");\n \t} elsif ($known_snapshot_formats{$format}{'disabled'}) {\n \t\tdie_error(403, \"Snapshot format not allowed\");\n+\t} elsif (!grep($_ eq $format, @snapshot_fmts)) {\n+\t\tdie_error(403, \"Unsupported snapshot format\");\n \t}\n \n \tif (!defined $hash) {\n-- \n1.6.4\n"}]}