Hi, if you configure Blazy with an image style and after you delete the image style, when you open a page with that blazy formatter (page or layout builder UI if you're using it), the website returns this type of error:

Error: Call to a member function buildUri() on null in /var/www/html/web/modules/contrib/blazy/src/BlazyManager.php

I've had to debug the code in order to get the names of the deleted image styles and recreate them. This allowed me to change the Blazy settings with another image style and after I've safely deleted the outdated image styles.

The blazy source code should verify the existence of image styles to avoid this bug.

I've created a small patch, let me know if it is ok (it also fixes the lightbox related code)

CommentFileSizeAuthor
check-if-image-style-exists.patch2.3 KBfinex

Comments

FiNeX created an issue. See original summary.

gausarts’s picture

Good catch. Thank you.

Please allow some delay to get back on this.

gausarts’s picture

Status: Active » Needs review

  • gausarts committed 76646d1 on 8.x-2.x authored by FiNeX
    Issue #3138996 by FiNeX: Check if image style exists to avoid Error
    
gausarts’s picture

Status: Needs review » Fixed

Committed with minor changes related to CS and correction to use $box_media_style accordingly. Thank you for contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.