Skip to content

Conversation

@buutqn
Copy link

@buutqn buutqn commented Jan 27, 2026

Fix WP_Customize_Media_Control::to_json() extension validation.

Trac ticket: #64557

Fix WP_Customize_Media_Control::to_json() extension validation.
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props buutqn, westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

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 fixes the extension validation logic in WP_Customize_Media_Control::to_json() by replacing a simple substring operation with WordPress's standard wp_check_filetype() function to properly determine file extensions.

Changes:

  • Replaced substr($this->setting->default, -3) with wp_check_filetype($this->setting->default)['ext'] to correctly extract file extensions of any length and validate them against WordPress's known mime types

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

@westonruter
Copy link
Member

Note: In the future, it would be preferable to open a pull request to target trunk rather than the current release branch.

@westonruter
Copy link
Member

Closing in favor of #10842

@westonruter westonruter closed this Feb 2, 2026
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