diff --git a/classes/Task/Update/UpdateComplete.php b/classes/Task/Update/UpdateComplete.php
index a25888729..78adb6cb3 100644
--- a/classes/Task/Update/UpdateComplete.php
+++ b/classes/Task/Update/UpdateComplete.php
@@ -68,7 +68,7 @@ public function run(): int
$this->logger->debug('' . $this->translator->trans('Please remove %s by FTP', [$this->container->getFilePath()]) . '');
}
- if ($this->container->getUpgradeConfiguration()->getChannel() != 'directory' && file_exists($this->container->getProperty(UpgradeContainer::LATEST_PATH)) && FilesystemAdapter::deleteDirectory($this->container->getProperty(UpgradeContainer::LATEST_PATH))) {
+ if (file_exists($this->container->getProperty(UpgradeContainer::LATEST_PATH)) && FilesystemAdapter::deleteDirectory($this->container->getProperty(UpgradeContainer::LATEST_PATH))) {
$this->logger->debug($this->translator->trans('%s removed', [$this->container->getProperty(UpgradeContainer::LATEST_PATH)]));
} elseif (is_dir($this->container->getProperty(UpgradeContainer::LATEST_PATH))) {
$this->logger->debug('' . $this->translator->trans('Please remove %s by FTP', [$this->container->getProperty(UpgradeContainer::LATEST_PATH)]) . '');
diff --git a/tests/unit/UpgradeContainer/FilesystemAdapterTest.php b/tests/unit/UpgradeContainer/FilesystemAdapterTest.php
index 9d44a9205..9400f8fda 100644
--- a/tests/unit/UpgradeContainer/FilesystemAdapterTest.php
+++ b/tests/unit/UpgradeContainer/FilesystemAdapterTest.php
@@ -26,6 +26,7 @@
*/
use PHPUnit\Framework\TestCase;
+use PrestaShop\Module\AutoUpgrade\Parameters\UpgradeConfiguration;
use PrestaShop\Module\AutoUpgrade\UpgradeContainer;
class FilesystemAdapterTest extends TestCase