mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Merge branch '1.13' into 1.14
* 1.13: [ApiBundle][Image] Prevent resolving non-serialized image paths
This commit is contained in:
commit
83366dc7a2
2 changed files with 24 additions and 1 deletions
|
|
@ -47,7 +47,10 @@ class ImageNormalizer implements ContextAwareNormalizerInterface, NormalizerAwar
|
|||
|
||||
/** @var array<string, string> $data */
|
||||
$data = $this->normalizer->normalize($object, $format, $context);
|
||||
$data['path'] = $this->resolvePath($data);
|
||||
|
||||
if (true === array_key_exists('path', $data)) {
|
||||
$data['path'] = $this->resolvePath($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,26 @@ final class ImageNormalizerSpec extends ObjectBehavior
|
|||
;
|
||||
}
|
||||
|
||||
function it_does_not_resolve_image_path_if_path_is_not_serialized(
|
||||
CacheManager $cacheManager,
|
||||
RequestStack $requestStack,
|
||||
NormalizerInterface $normalizer,
|
||||
Request $request,
|
||||
ParameterBag $queryBag,
|
||||
ImageInterface $image,
|
||||
): void {
|
||||
$normalizer
|
||||
->normalize($image, null, ['sylius_image_normalizer_already_called' => true])
|
||||
->shouldBeCalled()
|
||||
->willReturn(['id' => 1])
|
||||
;
|
||||
|
||||
$this->normalize($image, null, [])->shouldReturn(['id' => 1]);
|
||||
|
||||
$cacheManager->getBrowserPath(Argument::any(), Argument::any())->shouldNotHaveBeenCalled();
|
||||
$requestStack->getCurrentRequest()->shouldNotHaveBeenCalled();
|
||||
}
|
||||
|
||||
function it_applies_given_image_filter(
|
||||
CacheManager $cacheManager,
|
||||
RequestStack $requestStack,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue