Skip to content

Conversation

@peterwilsoncc
Copy link
Contributor

Summary

Modifies the dominant colour detection function to use an allow list of mime types based on image types supported in WordPress. This prevents the feature from running on other media types such as video, zips, etc.

Fixes #1957

Relevant technical choices

Runs the colour detection on the supported mime types

$supported_mime_types = array(
	'image/jpeg',
	'image/png',
	'image/gif',
	'image/webp',
	'image/avif',
);

Introduces the filter dominant_color_supported_mime_types to allow third party developers to extend the feature.

Use of AI Tools

N/A

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.89%. Comparing base (7938a41) to head (88a95a1).
⚠️ Report is 15 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/dominant-color-images/helper.php 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2264      +/-   ##
==========================================
+ Coverage   68.86%   68.89%   +0.02%     
==========================================
  Files          90       90              
  Lines        7610     7617       +7     
==========================================
+ Hits         5241     5248       +7     
  Misses       2369     2369              
Flag Coverage Δ
multisite 68.89% <90.00%> (+0.02%) ⬆️
single 35.53% <90.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Site crashes when uploading a video

1 participant