]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: support to globally disable a snapshot format
[Gitweb] / gitweb.perl
index 3eb82ef97a48c19e543cce6ff127774bfa2fdbbeee38e2005e2a392055312634..28833a8c90c8092f674e48ee6a6549768f3b8f048616f3347070115c0ea271df 100755 (executable)
@@ -161,7 +161,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',
@@ -495,7 +496,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++";
@@ -5182,6 +5184,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) {
This page took 0.282459 seconds and 4 git commands to generate.