-
Notifications
You must be signed in to change notification settings - Fork 29
NextImage imageParams results in broken images when using Edge Preview Context #405
Description
Describe the Bug
When running against the Sitecore Edge Preview Context, using any imageParams for the NextImage (as documented here) results in broken image URLs.
To Reproduce
- Add
imageParamsto aNextImage - Configure app to use your environment's preview context and run
Expected Behavior
Image renders properly
Possible Fix
The issue appears to stem from the fact that the preview media URLs use specific query parameters such as ttc, tt, and hash - which are stripped when run through updateImageUrl. Possible those parameters just need to be added to getRequiredParams. However, I'm guessing it's not that simple - since the hash is based on the original parameters, that hash would likely not work for any new parameters.
For example, when using the documented example, the resulting (failing) URL is:
https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?mw=100&mh=50
However, if you remove imageParams, the resulting (successful) URL is:
https://xmc-<customer>.sitecorecloud.io/-/jssmedia/my/image.png?h=423&iar=0&w=564&ttc=63908923158&tt=20634CFEEA2A98DD393960A582C5921A&hash=374DCBDC0C6EF657B922B08CF5E39C14
Provide environment information
- Sitecore Version: Sitecore AI
- Content SDK Version: 1.4.1
- Browser Name and version: N/A
- Operating System and version (desktop or mobile): N/A
- Link to your project (if available): N/A