Skip to content

Fixed Accept uppercase image extensions (.JPG/.JPEG) [2.0 ] - #513

Merged
navneetkumar-pim-webkul merged 1 commit into
unopim:2.0from
dripar-webkul:fix/issue-502-uppercase-image-extension-2.0
Jun 19, 2026
Merged

navneetkumar-pim-webkul merged 1 commit into
unopim:2.0from
dripar-webkul:fix/issue-502-uppercase-image-extension-2.0

Conversation

@dripar-webkul

Copy link
Copy Markdown
Collaborator

Description

Backport of to the 2.0 branch.

Uploading a valid image whose filename has an UPPERCASE extension
(e.g. IMG_1234.JPG, PHOTO.JPEG — common for camera/iPhone exports)
was rejected with "The image field must have one of the following
extensions...", even though the file was a genuine image.

Root cause: IMAGE_ALLOWED_EXTENSIONS is lowercase and the extension
comparisons were case-sensitive, so "JPG" !== "jpg".

This affected two rules — the second is why a single-line fix would have
been incomplete (the error would have just moved from validation.extensions
to file-mime-extension-mismatch):

  • packages/Webkul/Core/src/Rules/FileOrImageValidValue.php — lowercase
    the extension in the allowed-extensions in_array() check.
  • packages/Webkul/Core/src/Rules/FileMimeExtensionMatch.php — lowercase
    the extension in the guessExtension() comparison.

Lowercasing is applied only inside the comparisons, so:

  • already-lowercase uploads behave identically (zero behavior change),
  • error messages and mime lookups are untouched,
  • the mime-vs-extension security check still runs — a file whose real
    type doesn't match its extension is still rejected.

Impacted upload paths: product image/file attributes, category image
fields, attribute-option swatches, user profile image, and TinyMCE
rich-text uploads.

The patch from #511 applied cleanly to 2.0 (both files match context).

How To Test This?

  1. Take any valid .jpg image and rename the extension to uppercase .JPG.
  2. Upload it to a product Image attribute → it is now accepted.
  3. Repeat with .JPEG and .PNG → accepted.
  4. Confirm .jpg (lowercase) still uploads as before.
  5. Negative check: rename a non-image file to .JPG (mismatched real
    type) → still rejected by the mime/extension check.

Checklist

  • vendor/bin/pest passes locally
  • vendor/bin/pint --test reports no style issues
  • Tailwind classes are reordered
  • New user-facing strings use translation keys (all 33 locales)
  • Target branch is 2.0 (unless a maintainer requested a backport)

@navneetkumar-pim-webkul
navneetkumar-pim-webkul merged commit ba5137e into unopim:2.0 Jun 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants