Skip to content

Commit a979b95

Browse files
author
Ilia Rostovtsev
committed
Fix to fall to use zip by default if available otherwise use tar command
1 parent 7801903 commit a979b95

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extensions/file-manager/download.cgi

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use Time::Local;
1414
require(dirname(__FILE__) . '/file-manager-lib.pm');
1515

1616
my $command;
17-
my $extension = "tar.gz";
17+
my $has_zip = has_command('zip');
18+
my $extension = $has_zip ? "zip" : "tar.gz";
1819
my $filename = $in{'filename'};
1920
my $target = tempname("$filename.$extension");
2021

@@ -41,8 +42,12 @@ if ($in{'cancel'} eq '1') {
4142
}
4243
}
4344
} else {
45+
if ($has_zip) {
46+
$command = "cd " . quotemeta($cwd) . " && zip -r " . quotemeta($target);
47+
} else {
48+
$command = "tar czf " . quotemeta($target) . " -C " . quotemeta($cwd);
49+
}
4450

45-
$command = "tar czf " . quotemeta($target) . " -C " . quotemeta($cwd);
4651
foreach my $name (split(/\0/, $in{'name'})) {
4752
$name =~ s/$in{'cwd'}\///ig;
4853
if (-e ($cwd . '/' . $name)) {

0 commit comments

Comments
 (0)