diff --git a/controller/common/src/Controller/Common/Media/Standard.php b/controller/common/src/Controller/Common/Media/Standard.php index 4e862a7372..840a9a7cda 100644 --- a/controller/common/src/Controller/Common/Media/Standard.php +++ b/controller/common/src/Controller/Common/Media/Standard.php @@ -132,6 +132,7 @@ public function delete( \Aimeos\MShop\Media\Item\Iface $item, $fsname = 'fs-medi return $item->setUrl( '' )->setPreview( '' ); } + $mimedir = (string) $this->context->getConfig()->get( 'controller/common/media/standard/mimeicon/directory' ); $fs = $this->context->getFilesystemManager()->get( $fsname ); $path = $item->getUrl(); @@ -143,11 +144,11 @@ public function delete( \Aimeos\MShop\Media\Item\Iface $item, $fsname = 'fs-medi { try { - if( $preview !== '' && $fs->has( $preview ) ) { + if( $preview !== '' && !strcmp( $preview, $mimedir ) && $fs->has( $preview ) ) { $fs->rm( $preview ); } } - catch( \Exception $e ) { ; } // Can be a mime icon with relative path + catch( \Exception $e ) { ; } // continue if removing file fails } return $item->setUrl( '' )->setPreviews( [] )->deletePropertyItems( $item->getPropertyItems() );