mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-16 18:44:32 +00:00
Add unit tests for wp_attachment_is(), checks the whitelist and arbitrary extension.
See #25275. git-svn-id: https://develop.svn.wordpress.org/trunk@31647 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5091,11 +5091,16 @@ function wp_attachment_is( $type, $post_id = 0 ) {
|
||||
}
|
||||
|
||||
$check = wp_check_filetype( $file );
|
||||
if ( empty( $check['ext'] ) || 'import' !== $post->post_mime_type ) {
|
||||
if ( empty( $check['ext'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ext = $check['ext'];
|
||||
|
||||
if ( 'import' !== $post->post_mime_type ) {
|
||||
return $type === $ext;
|
||||
}
|
||||
|
||||
switch ( $type ) {
|
||||
case 'image':
|
||||
$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
|
||||
|
||||
Reference in New Issue
Block a user