Skip to content

FIX: Accept upload extensions in any case - #337

Merged
angusmcleod merged 1 commit into
paviliondev:mainfrom
davidlippidinova:fix/upload-extension-case
Nov 10, 2026
Merged

angusmcleod merged 1 commit into
paviliondev:mainfrom
davidlippidinova:fix/upload-extension-case

Conversation

@sisti86dinova

Copy link
Copy Markdown
Contributor

The upload field compares the file's extension with the allowed file types case-sensitively, so PICTURE.JPG is rejected when the field allows .jpg ("Immagine must be a .jpg,.jpeg,.png"). Phones and cameras often name files in uppercase, and our users hit this regularly.

validate_file_type now:

  • compares extensions case-insensitively (PICTURE.JPG matches .jpg; .JPG in the field matches picture.jpg);
  • ignores spaces around the allowed types (.jpg, .png);
  • still accepts types written without a dot (webp), as before;
  • rejects files without an extension instead of raising.

Added specs for these cases in update_validator_spec.rb. Checked on a local Discourse (2026.11.0-latest): full plugin suite passes (except a system spec that needs Playwright's Chromium, unrelated), and an end-to-end run of our production wizards now accepts PICTURE.JPG.

The upload field compared the file extension with the allowed file
types case-sensitively, so FOTO.JPG was rejected when the field allowed
.jpg. Phones and cameras often name files in uppercase.

Compare extensions case-insensitively and ignore spaces around the
allowed file types (".jpg, .png").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@angusmcleod
angusmcleod merged commit ba3c147 into paviliondev:main Nov 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants