From 2faf826f6efee16e526f19212f6aa4291e41294e Mon Sep 17 00:00:00 2001 From: Nattfarinn Date: Thu, 1 Oct 2015 15:40:06 +0200 Subject: [PATCH] fix: return empty value if source binary file is missing --- Rest/Field/TypeValue.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Rest/Field/TypeValue.php b/Rest/Field/TypeValue.php index 86401d4..44d4fb8 100644 --- a/Rest/Field/TypeValue.php +++ b/Rest/Field/TypeValue.php @@ -9,6 +9,7 @@ use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver; use eZ\Bundle\EzPublishCoreBundle\Imagine\AliasGenerator as ImageVariationService; +use eZ\Publish\Core\MVC\Exception\SourceImageNotFoundException; use eZ\Publish\API\Repository\Values\Content\Content; use eZ\Publish\API\Repository\Values\Content\Field; use eZ\Publish\Core\FieldType\XmlText\Converter\Html5; @@ -98,7 +99,11 @@ public function ezimage(Field $field, Content $content) $variation = $requestedVariation; } - return $this->imageVariationService->getVariation($field, $content->versionInfo, $variation)->uri; + try { + return $this->imageVariationService->getVariation($field, $content->versionInfo, $variation)->uri; + } catch (SourceImageNotFoundException $exception) { + return ''; + } } /**