@@ -160,7 +160,8 @@ BEGIN
160
160
# 'suffix' => filename suffix,
161
161
# 'format' => --format for git-archive,
162
162
# 'compressor' => [compressor command and arguments]
163
- # (array reference, optional)}
163
+ # (array reference, optional)
164
+ # 'disabled' => boolean (optional)}
164
165
#
165
166
' tgz' => {
166
167
' display' => ' tar.gz' ,
@@ -176,6 +177,14 @@ BEGIN
176
177
' format' => ' tar' ,
177
178
' compressor' => [' bzip2' ]},
178
179
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
+
179
188
' zip' => {
180
189
' display' => ' zip' ,
181
190
' type' => ' application/x-zip' ,
@@ -188,6 +197,7 @@ BEGIN
188
197
our %known_snapshot_format_aliases = (
189
198
' gzip' => ' tgz' ,
190
199
' bzip2' => ' tbz2' ,
200
+ ' xz' => ' txz' ,
191
201
192
202
# backward compatibility: legacy gitweb config support
193
203
' x-gzip' => undef , ' gz' => undef ,
@@ -494,7 +504,8 @@ sub filter_snapshot_fmts {
494
504
exists $known_snapshot_format_aliases {$_ } ?
495
505
$known_snapshot_format_aliases {$_ } : $_ } @fmts ;
496
506
@fmts = grep {
497
- exists $known_snapshot_formats {$_ } } @fmts ;
507
+ exists $known_snapshot_formats {$_ } &&
508
+ !$known_snapshot_formats {$_ }{' disabled' }} @fmts ;
498
509
}
499
510
500
511
our $GITWEB_CONFIG = $ENV {' GITWEB_CONFIG' } || " ++GITWEB_CONFIG++" ;
@@ -5181,6 +5192,8 @@ sub git_snapshot {
5181
5192
die_error(400, " Unknown snapshot format" );
5182
5193
} elsif (!grep ($_ eq $format , @snapshot_fmts )) {
5183
5194
die_error(403, " Unsupported snapshot format" );
5195
+ } elsif ($known_snapshot_formats {$format }{' disabled' }) {
5196
+ die_error(403, " Snapshot format not allowed" );
5184
5197
}
5185
5198
5186
5199
if (!defined $hash ) {
0 commit comments