aem-core-wcm-components icon indicating copy to clipboard operation
aem-core-wcm-components copied to clipboard

[Imagev3] Add url encoding to DM image srcset attribute

Open chicharr opened this issue 2 years ago • 0 comments

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

chicharr avatar Apr 20 '22 11:04 chicharr