diff --git a/eZ/Publish/Core/IO/IOBinarydataHandler/Flysystem.php b/eZ/Publish/Core/IO/IOBinarydataHandler/Flysystem.php index 433802adf4..e0575b0b85 100644 --- a/eZ/Publish/Core/IO/IOBinarydataHandler/Flysystem.php +++ b/eZ/Publish/Core/IO/IOBinarydataHandler/Flysystem.php @@ -11,6 +11,7 @@ use eZ\Publish\Core\IO\UrlDecorator; use eZ\Publish\SPI\IO\BinaryFileCreateStruct; use League\Flysystem\AdapterInterface; +use League\Flysystem\CorruptedPathDetected; use League\Flysystem\FileExistsException; use League\Flysystem\FileNotFoundException as FlysystemNotFoundException; use League\Flysystem\FilesystemInterface; @@ -56,7 +57,7 @@ public function delete($spiBinaryFileId) { try { $this->filesystem->delete($spiBinaryFileId); - } catch (FlysystemNotFoundException $e) { + } catch (FlysystemNotFoundException|CorruptedPathDetected $e) { throw new BinaryFileNotFoundException($spiBinaryFileId, $e); } } diff --git a/eZ/Publish/Core/IO/IOMetadataHandler/Flysystem.php b/eZ/Publish/Core/IO/IOMetadataHandler/Flysystem.php index cc8036d3cb..80c9af1790 100644 --- a/eZ/Publish/Core/IO/IOMetadataHandler/Flysystem.php +++ b/eZ/Publish/Core/IO/IOMetadataHandler/Flysystem.php @@ -11,6 +11,7 @@ use eZ\Publish\Core\IO\IOMetadataHandler; use eZ\Publish\SPI\IO\BinaryFile as SPIBinaryFile; use eZ\Publish\SPI\IO\BinaryFileCreateStruct as SPIBinaryFileCreateStruct; +use League\Flysystem\CorruptedPathDetected; use League\Flysystem\FileNotFoundException; use League\Flysystem\FilesystemInterface; @@ -47,7 +48,7 @@ public function load($spiBinaryFileId) { try { $info = $this->filesystem->getMetadata($spiBinaryFileId); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException|CorruptedPathDetected $e) { throw new BinaryFileNotFoundException($spiBinaryFileId); } @@ -64,7 +65,11 @@ public function load($spiBinaryFileId) public function exists($spiBinaryFileId) { - return $this->filesystem->has($spiBinaryFileId); + try { + return $this->filesystem->has($spiBinaryFileId); + } catch (CorruptedPathDetected $e) { + return false; + } } public function getMimeType($spiBinaryFileId)