Ticket #32746: 32746.patch
| File 32746.patch, 2.9 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/js/media/models/attachments.js
491 491 * @returns {Boolean} 492 492 */ 493 493 type: function( attachment ) { 494 var type = this.props.get('type'), atts = attachment.toJSON(), mime, found; 494 // Return of the type is not defined 495 if( ! this.props.get("type") ) { 496 return true; 497 } 495 498 496 mime = atts.mime || ( atts.file && atts.file.type ) || ''; 499 var type = this.props.get('type'), 500 attachmentType = attachment.get("type"), found; 497 501 498 if ( _.isArray( type ) ) { 499 found = ! type.length || _.find( type, function (t) { 500 return -1 !== mime.indexOf( t ); 501 } ); 502 } else { 503 found = ! type || -1 !== mime.indexOf( type ); 504 } 502 //Chek if the define mime type is array. 503 //If yes, loop though each and compare 504 if ( _.isArray( type ) ) { 505 found = _.find( type, function (t) { 506 return -1 !== t.indexOf( attachmentType ); 507 } ); 508 } else { 509 found = -1 !== type.indexOf( attachmentType ); 510 } 505 511 506 return found; 507 }, 512 return found; 513 514 }, 508 515 /** 509 516 * @static 510 517 * @param {wp.media.model.Attachment} attachment -
src/wp-includes/js/media-models.js
895 895 * @returns {Boolean} 896 896 */ 897 897 type: function( attachment ) { 898 var type = this.props.get('type'), atts = attachment.toJSON(), mime, found; 898 // Return of the type is not defined 899 if( ! this.props.get("type") ) { 900 return true; 901 } 899 902 900 mime = atts.mime || ( atts.file && atts.file.type ) || ''; 903 var type = this.props.get('type'), 904 attachmentType = attachment.get("type"), found; 901 905 902 if ( _.isArray( type ) ) { 903 found = ! type.length || _.find( type, function (t) { 904 return -1 !== mime.indexOf( t ); 905 } ); 906 } else { 907 found = ! type || -1 !== mime.indexOf( type ); 908 } 906 //Chek if the define mime type is array. 907 //If yes, loop though each and compare 908 if ( _.isArray( type ) ) { 909 found = _.find( type, function (t) { 910 return -1 !== t.indexOf( attachmentType ); 911 } ); 912 } else { 913 found = -1 !== type.indexOf( attachmentType ); 914 } 909 915 910 return found; 911 }, 916 return found; 917 918 }, 912 919 /** 913 920 * @static 914 921 * @param {wp.media.model.Attachment} attachment