diff --git a/src/wp-includes/js/media-models.js b/src/wp-includes/js/media-models.js index 4bc7f61c65..90a17e94d2 100644 --- a/src/wp-includes/js/media-models.js +++ b/src/wp-includes/js/media-models.js @@ -895,8 +895,19 @@ var Attachments = Backbone.Collection.extend({ * @returns {Boolean} */ type: function( attachment ) { - var type = this.props.get('type'); - return ! type || -1 !== type.indexOf( attachment.get('type') ); + var type = this.props.get('type'), atts = attachment.toJSON(), mime, found; + + mime = atts.mime || ( atts.file && atts.file.type ) || ''; + + if ( _.isArray( type ) ) { + found = _.find( type, function (t) { + return -1 !== mime.indexOf( t ); + } ); + } else { + found = ! type || -1 !== mime.indexOf( type ); + } + + return found; }, /** * @static diff --git a/src/wp-includes/js/media/models/attachments.js b/src/wp-includes/js/media/models/attachments.js index 5f0f26d618..9b6e86cd2f 100644 --- a/src/wp-includes/js/media/models/attachments.js +++ b/src/wp-includes/js/media/models/attachments.js @@ -491,8 +491,19 @@ var Attachments = Backbone.Collection.extend({ * @returns {Boolean} */ type: function( attachment ) { - var type = this.props.get('type'); - return ! type || -1 !== type.indexOf( attachment.get('type') ); + var type = this.props.get('type'), atts = attachment.toJSON(), mime, found; + + mime = atts.mime || ( atts.file && atts.file.type ) || ''; + + if ( _.isArray( type ) ) { + found = _.find( type, function (t) { + return -1 !== mime.indexOf( t ); + } ); + } else { + found = ! type || -1 !== mime.indexOf( type ); + } + + return found; }, /** * @static