Skip to content

WebP images blocked due to missing file extension in upload handler #150

@pixelpadre

Description

@pixelpadre

Issue: Uploading .webp images without checking “Use Original Image Name” causes the file to be saved without an extension (e.g., myimage instead of myimage.webp). This breaks browser rendering, triggers ModSecurity blocks, and leads to missing or incorrect Content-Type.

File affected: admin/plugins/jQuery-File-Upload/php/UploadHandler.php

Steps to Reproduce:

Upload a .webp image

Uncheck “Use Original Image Name”

File is saved without .webp extension

Image fails to load or gets blocked

Root Cause:

.webp is missing from MIME regex

get_file_type() doesn’t recognize .webp

exif_imagetype() switch lacks IMAGETYPE_WEBP

Suggested Fix:

Add webp to MIME regex: /(gif|jpe?g|png|webp)/

Add case IMAGETYPE_WEBP to image type detection

Update get_file_type() to return 'image/webp' for .webp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions