[BUGFIX] Check if file exists before deletion
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / ResourceStorage.php
index 12f191e..12215c0 100644 (file)
@@ -1578,9 +1578,11 @@ class ResourceStorage implements ResourceStorageInterface {
 
                $this->emitPreFileDeleteSignal($fileObject);
 
-               $result = $this->driver->deleteFile($fileObject->getIdentifier());
-               if ($result === FALSE) {
-                       throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691);
+               if ($this->driver->fileExists($fileObject->getIdentifier())) {
+                       $result = $this->driver->deleteFile($fileObject->getIdentifier());
+                       if (!$result) {
+                               throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691);
+                       }
                }
                // Mark the file object as deleted
                if ($fileObject instanceof File) {