Skip to content

Fixed Accept uppercase image extensions (.JPG/.JPEG) - #512

Merged
navneetkumar-pim-webkul merged 2 commits into
unopim:masterfrom
dripar-webkul:fix/issue-502-uppercase-image-extension-master
Jun 19, 2026
Merged

navneetkumar-pim-webkul merged 2 commits into
unopim:masterfrom
dripar-webkul:fix/issue-502-uppercase-image-extension-master

Conversation

@dripar-webkul

Copy link
Copy Markdown
Collaborator

Description

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.

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 master

@navneetkumar-pim-webkul
navneetkumar-pim-webkul merged commit 5aca34d into unopim:master Jun 19, 2026
15 of 16 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