Skip to content

Enhanced file type validation#2798

Open
girishpanchal30 wants to merge 3 commits into
developmentfrom
bugfix/otter-internal/245
Open

Enhanced file type validation#2798
girishpanchal30 wants to merge 3 commits into
developmentfrom
bugfix/otter-internal/245

Conversation

@girishpanchal30
Copy link
Copy Markdown
Contributor

Closes https://github.com/Codeinwp/otter-internals/issues/245

Summary

Enhance the validation of uploaded file MIME types.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@girishpanchal30 girishpanchal30 requested a review from Copilot May 13, 2026 14:10
@girishpanchal30 girishpanchal30 added the pr-checklist-skip Allow this Pull Request to skip checklist. label May 13, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label May 13, 2026
@pirate-bot
Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 276.77 KB 276.77 KB 0 B (0.00%)
Blocks 1.55 MB 1.55 MB 0 B (0.00%)
CSS 105.9 KB 105.9 KB 0 B (0.00%)
Dashboard 204.08 KB 204.08 KB 0 B (0.00%)
Onboarding 165.94 KB 165.94 KB 0 B (0.00%)
Export Import 102.86 KB 102.86 KB 0 B (0.00%)
Pro 412.55 KB 412.55 KB 0 B (0.00%)

@pirate-bot
Copy link
Copy Markdown
Contributor

pirate-bot commented May 13, 2026

Plugin build for ff2d4fb is ready 🛎️!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances server-side validation for uploaded files in the Otter Pro Form workflow by mapping the configured allowedFileTypes to MIME patterns and validating uploads via wp_match_mime_types().

Changes:

  • Convert allowedFileTypes entries into an $allowed_mimes list using WordPress’ MIME map (wp_get_mime_types()), while supporting wildcard patterns like image/*.
  • Validate uploaded files by matching the detected MIME type against the derived allowlist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/otter-pro/inc/plugins/class-form-pro-features.php Outdated
Comment thread plugins/otter-pro/inc/plugins/class-form-pro-features.php
Comment thread plugins/otter-pro/inc/plugins/class-form-pro-features.php Outdated
@pirate-bot
Copy link
Copy Markdown
Contributor

pirate-bot commented May 13, 2026

E2E Tests

Playwright Test Status:

Performance Results serverResponse: {"q25":418,"q50":420,"q75":421.7,"cnt":10}, firstPaint: {"q25":449.6,"q50":471.55,"q75":493.5,"cnt":10}, domContentLoaded: {"q25":1522,"q50":1527.05,"q75":1548.6,"cnt":10}, loaded: {"q25":1522.5,"q50":1527.5,"q75":1549,"cnt":10}, firstContentfulPaint: {"q25":3233.6,"q50":3249.7,"q75":3281.6,"cnt":10}, firstBlock: {"q25":6599.7,"q50":6643.3,"q75":6747.7,"cnt":10}, type: {"q25":12.13,"q50":12.59,"q75":13.48,"cnt":10}, typeWithoutInspector: {"q25":11.86,"q50":12.09,"q75":12.55,"cnt":10}, typeWithTopToolbar: {"q25":16.77,"q50":17.4,"q75":18.46,"cnt":10}, typeContainer: {"q25":7.25,"q50":7.91,"q75":8.7,"cnt":10}, focus: {"q25":52.75,"q50":57.92,"q75":59.24,"cnt":10}, inserterOpen: {"q25":16.77,"q50":17.56,"q75":21.65,"cnt":10}, inserterSearch: {"q25":5.62,"q50":5.75,"q75":6.03,"cnt":10}, inserterHover: {"q25":2.48,"q50":2.66,"q75":2.86,"cnt":20}, loadPatterns: {"q25":1077.61,"q50":1099.64,"q75":1129.87,"cnt":10}, listViewOpen: {"q25":83.99,"q50":88.67,"q75":97.92,"cnt":10}

@girishpanchal30 girishpanchal30 force-pushed the bugfix/otter-internal/245 branch from a2bca46 to ff2d4fb Compare May 14, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants