aem-core-wcm-components
aem-core-wcm-components copied to clipboard
[Imagev3] Add url encoding to DM image srcset attribute
Bug Report
Current Behavior
srcset is built using the output of the method getSrcUriTemplate()
and getWidths()
.
In order to build it, srcUriTemplate is decoded and manipulated replacing the {width}, however it is not encoded again before returned.
This causes problems for image urls that require encoding, for instance because they have blank spaces in the url.
E.g.
a srcUriTemplate like: https://assets.georgfischer.com/is/image/georgfischeragstage/Bolivia%20Project_Hero?qlt=82&ts=1644856523736&dpr=off
generates srcset like: https://assets.georgfischer.com/is/image/georgfischeragstage/Bolivia Project_Hero?qlt=82&wid=1280&ts=1644856523736&dpr=off 1280w
Notice the %20 missing in the image name "Bolivia Project_Hero"
Expected behavior/code image urls in srcset should be encoded
Environment
- AEM Cloud Service 2022.3.6698.20220318T233218Z
Possible Solution Encode the urls in srcset before returning them