Skip to content

Fingerprinted WebP images unrecognized by library.  #1

Description

@lozandier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions