@@ -160,7 +160,8 @@ BEGIN
160160 # 'suffix' => filename suffix,
161161 # 'format' => --format for git-archive,
162162 # 'compressor' => [compressor command and arguments]
163- # (array reference, optional)}
163+ # (array reference, optional)
164+ # 'disabled' => boolean (optional)}
164165 #
165166 ' tgz' => {
166167 ' display' => ' tar.gz' ,
@@ -176,6 +177,14 @@ BEGIN
176177 ' format' => ' tar' ,
177178 ' compressor' => [' bzip2' ]},
178179
180+ ' txz' => {
181+ ' display' => ' tar.xz' ,
182+ ' type' => ' application/x-xz' ,
183+ ' suffix' => ' .tar.xz' ,
184+ ' format' => ' tar' ,
185+ ' compressor' => [' xz' ],
186+ ' disabled' => 1},
187+
179188 ' zip' => {
180189 ' display' => ' zip' ,
181190 ' type' => ' application/x-zip' ,
@@ -188,6 +197,7 @@ BEGIN
188197our %known_snapshot_format_aliases = (
189198 ' gzip' => ' tgz' ,
190199 ' bzip2' => ' tbz2' ,
200+ ' xz' => ' txz' ,
191201
192202 # backward compatibility: legacy gitweb config support
193203 ' x-gzip' => undef , ' gz' => undef ,
@@ -494,7 +504,8 @@ sub filter_snapshot_fmts {
494504 exists $known_snapshot_format_aliases {$_ } ?
495505 $known_snapshot_format_aliases {$_ } : $_ } @fmts ;
496506 @fmts = grep {
497- exists $known_snapshot_formats {$_ } } @fmts ;
507+ exists $known_snapshot_formats {$_ } &&
508+ !$known_snapshot_formats {$_ }{' disabled' }} @fmts ;
498509}
499510
500511our $GITWEB_CONFIG = $ENV {' GITWEB_CONFIG' } || " ++GITWEB_CONFIG++" ;
@@ -5181,6 +5192,8 @@ sub git_snapshot {
51815192 die_error(400, " Unknown snapshot format" );
51825193 } elsif (!grep ($_ eq $format , @snapshot_fmts )) {
51835194 die_error(403, " Unsupported snapshot format" );
5195+ } elsif ($known_snapshot_formats {$format }{' disabled' }) {
5196+ die_error(403, " Snapshot format not allowed" );
51845197 }
51855198
51865199 if (!defined $hash ) {
0 commit comments