Skip to content

Images Retain Original Extensions but Are Delivered as WebP #22

Open
@letherman255

Description

@letherman255

Hi @Mecanik,

Thanks a lot for this great worker—it has saved us a ton of time and improved our site performance significantly!

We’ve implemented the worker as described, and it’s functioning well. Images are being dynamically converted to WebP and served correctly, which we verified using tools like an online WebP analyzer. However, there’s a small issue we’ve encountered:

When a user right-clicks on an image and selects "Open Image in New Tab" or "Save Image As," the file retains its original extension (e.g., .jpg or .png) even though the content is actually WebP.

This behavior can be confusing for end users and poses challenges when:

  1. Users try to view these files with software that doesn’t support WebP(e.g., older photo viewers).
  2. Some tools incorrectly treat the files based on their extensions rather than their MIME types.

We noticed that other websites using WebP prevent users from downloading images with their original extensions altogether. Instead, the downloaded files explicitly use .webp.

Would it be possible to adjust the worker to rewrite image URLs with their actual extensions (e.g., .webp) or to add a Content-Disposition header to ensure correct saving behavior?

If there’s already a solution or workaround for this, we’d love to hear about it! Thanks again for your incredible work on this tool.

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