Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit d13c601

Browse files
committed
Add a check if he user try to compress an empty folder to avoid some problems...
1 parent 7d82c50 commit d13c601

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/plugins/action.compression/class.PluginCompression.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function receiveAction($action, $httpVars, $fileVars)
7373
throw new AJXP_Exception($messages["compression.16"]);
7474
}
7575
$typeArchive = $httpVars["type_archive"];
76-
//if we can run in background we do it ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()
77-
if (1 == 2) {
76+
//if we can run in background we do it
77+
if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
7878
$archivePath = $currentDirPath.$archiveName;
7979
file_put_contents($progressCompressionFileName, $messages["compression.5"]);
8080
AJXP_Controller::applyActionInBackground($repository->getId(), "compression", $httpVars);
@@ -113,6 +113,10 @@ public function receiveAction($action, $httpVars, $fileVars)
113113
array_push($tabFilesNames, substr($file->getPathname(), $currentDirUrlLength));
114114
}
115115
}
116+
//WE STOP IF IT'S JUST AN EMPTY FOLDER OR NO FILES
117+
if (empty($tabFilesNames)) {
118+
throw new AJXP_Exception($messages["compression.17"]);
119+
}
116120
try {
117121
$tmpArchiveName = tempnam(AJXP_Utils::getAjxpTmpDir(), "tar-compression") . ".tar";
118122
$archive = new PharData($tmpArchiveName);

0 commit comments

Comments
 (0)