Skip to content
Snippets Groups Projects

Issue #3260831: .webp derivative not generated if .jpg derivative exists

1 file
+ 8
0
Compare changes
  • Side-by-side
  • Inline
@@ -43,6 +43,14 @@ class ImageStyleDownloadController extends CoreImageStyleDownloadController {
if ($source_uri = $this->lookupSourceImage($image_uri)) {
// Replace webp image with source image and call parent:deliver().
$request->query->set('file', str_replace($scheme . '://', '', $source_uri));
// See issue #3260831. If the derivative exists but the .webp doesn't,
// better delete the derivative, so we can regenerate both together.
$derivative_uri_jpg = $image_style->buildUri($source_uri);
if (file_exists($derivative_uri_jpg)) {
unlink($derivative_uri_jpg);
}
$source_response = parent::deliver($request, $scheme, $image_style);
$derivative_uri = $image_style->buildUri($image_uri);
// If parent:deliver() returns BinaryFileResponse, we'll replace
Loading