From f30b32cd14ec770d1ef73c1e686c6b8894d019fd Mon Sep 17 00:00:00 2001
From: Daniel Haupt <mail@danielhaupt.de>
Date: Wed, 7 Jul 2021 13:36:47 +0200
Subject: [PATCH] [BUGFIX] Unlink temp files in import of ext:impexp

The check that the file is in one of the temporary folders has been
removed, as this check is already done in the unlink method of the
GeneralUtility.

This patch specifically addresses composer based installations.

Resolves: #94500
Releases: master, 10.4, 9.5
Change-Id: I0a38f5ef3da3494ca38310033f63cc591931fb63
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69754
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/impexp/Classes/Import.php | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php
index 0a4db65d08fd..53750124c1bf 100644
--- a/typo3/sysext/impexp/Classes/Import.php
+++ b/typo3/sysext/impexp/Classes/Import.php
@@ -957,14 +957,10 @@ class Import extends ImportExport
     public function unlinkTempFiles()
     {
         foreach ($this->unlinkFiles as $fileName) {
-            if (GeneralUtility::isFirstPartOfStr($fileName, Environment::getPublicPath() . '/typo3temp/')) {
-                GeneralUtility::unlink_tempfile($fileName);
-                clearstatcache();
-                if (is_file($fileName)) {
-                    $this->error('Error: ' . $fileName . ' was NOT unlinked as it should have been!');
-                }
-            } else {
-                $this->error('Error: ' . $fileName . ' was not in temp-path. Not removed!');
+            GeneralUtility::unlink_tempfile($fileName);
+            clearstatcache();
+            if (is_file($fileName)) {
+                $this->error('Error: ' . $fileName . ' was NOT unlinked as it should have been!');
             }
         }
         $this->unlinkFiles = [];
-- 
GitLab