summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorMark A Rada <marada@uwaterloo.ca>2009-08-06 10:25:39 -0400
committerJunio C Hamano <gitster@pobox.com>2009-08-06 14:03:25 -0700
commit1bfd363184d5bd0eb81565bfa2cc1084f35dbbdf (patch)
treec0cc168ccab56807d1398f36129ba38a185c520b /gitweb
parent3f55e4107f7906134df029f9a5c44864f9258110 (diff)
downloadgit-1bfd363184d5bd0eb81565bfa2cc1084f35dbbdf.tar.gz
gitweb: support to globally disable a snapshot format
Allow Gitweb administrators to set a 'disabled' key in the %known_snapshot_formats hash to disable a specific snapshot format. All formats are enabled by default to maintain backwards compatibility. Signed-off-by: Mark Rada <marada@uwaterloo.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl8
1 files changed, 6 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 37120a3e60..a0cdf31666 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -160,7 +160,8 @@ our %known_snapshot_formats = (
# 'suffix' => filename suffix,
# 'format' => --format for git-archive,
# 'compressor' => [compressor command and arguments]
- # (array reference, optional)}
+ # (array reference, optional)
+ # 'disabled' => boolean (optional)}
#
'tgz' => {
'display' => 'tar.gz',
@@ -494,7 +495,8 @@ sub filter_snapshot_fmts {
exists $known_snapshot_format_aliases{$_} ?
$known_snapshot_format_aliases{$_} : $_} @fmts;
@fmts = grep {
- exists $known_snapshot_formats{$_} } @fmts;
+ exists $known_snapshot_formats{$_} &&
+ !$known_snapshot_formats{$_}{'disabled'}} @fmts;
}
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
@@ -5166,6 +5168,8 @@ sub git_snapshot {
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");
}
if (!defined $hash) {