Due to the library's method of checking whether or not an image is a webP image, webP images are not converted for browsers without webP support is fingerprinted or has additional parameters/characters added to the filename.
The library currently uses a substring that checks for the last 5 characters of each image present in the dom.
The substring had this pattern if (a.substr(a.length - 5, a.length) == ".webp"). A regular expression like if (a.match(/[\w.\-\s]+(?=\.)+\.webp/ig))
Therefore, an image with the filename kitty.webp would be appropriately converted but not an image with the filename of flawed_kitty.webp?fierce=2&weak=0
This is quite limiting for those who use web frameworks such as Ruby on Rails that fingerprint files for caching purposes.
After a couple days this past summer diagnosing odd behavior with webP images associated with models in Ruby Applications with fellow Ruby Developers, this problem was found when image_tag worked for asset images but not for images within models that uses fingerprint digests to keep track of changes of images.
Due to the library's method of checking whether or not an image is a webP image, webP images are not converted for browsers without webP support is fingerprinted or has additional parameters/characters added to the filename.
The library currently uses a substring that checks for the last 5 characters of each image present in the dom.
The substring had this pattern
if (a.substr(a.length - 5, a.length) == ".webp"). A regular expression likeif (a.match(/[\w.\-\s]+(?=\.)+\.webp/ig))Therefore, an image with the filename
kitty.webpwould be appropriately converted but not an image with the filename offlawed_kitty.webp?fierce=2&weak=0This is quite limiting for those who use web frameworks such as Ruby on Rails that fingerprint files for caching purposes.
After a couple days this past summer diagnosing odd behavior with webP images associated with models in Ruby Applications with fellow Ruby Developers, this problem was found when
image_tagworked for asset images but not for images within models that uses fingerprint digests to keep track of changes of images.