Skip to content

Commit

Permalink
Merge pull request #41 from Nattfarinn/fix-missing-binary-file
Browse files Browse the repository at this point in the history
fix: return empty value if source binary file is missing
  • Loading branch information
lserwatka committed Oct 1, 2015
2 parents 5ffba8b + 2faf826 commit 2861d6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Rest/Field/TypeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 '';
}
}

/**
Expand Down

0 comments on commit 2861d6e

Please sign in to comment.