Problem/Motivation
DrimageSubscriber listens on kernel.request at priority 0, after core's RouterListener (32), so a request for a style that does not exist yet 404s in routing first.
- New sizes fail on the first request. The subscriber only runs inside the 404 sub-request, creates the style there and returns the image inside the 404 response (
image/webp, and on some hosts a malformed HTTP/2 response a CDN reports as 520). The second request succeeds. - Near sizes never succeed. Within
ratio_distortionof an existing style,findImageStyle()reuses that style and never creates the requested name, so the URL 404s every time (e.g.drimage_improved_focal_720_414while_720_406exists). One site had 67 image URLs failing this way.
Seen on 1.0.13, Drupal 11.4.7, Varbase 11 with focal_point, single-site and multisite. Related: #3467535: Fix hitting the page with images for the first time results in having images with `page not found` warnings in the syslog.
Steps to reproduce
- Install with focal_point and use the Drimage formatter.
- Request
/sites/default/files/styles/drimage_improved_focal_533_300/public/IMAGE.webpfor an existing image and a size with no style yet: 404 first, 200 after. - Request a size one pixel from an existing style: 404 every time.
Proposed resolution
Subscribe at priority 33 in getSubscribedEvents(), before the router. The first request then returns 200 for missing and near sizes alike. Deployed on a live Varbase 11 multisite, all 107 image URLs that had failed now return 200.
Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ✅ Update Release Notes
- ✅ Release
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- N/A
Issue fork drimage_improved-3626466
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahComment #4
rajab natshahComment #6
rajab natshahComment #7
rajab natshah✅ Released in drimage_improved-1.0.14