Because programming is fun. After [32915], _.find()
will return undefined
if an empty array is passed - in that case, the function should return true
.
See #32746. git-svn-id: https://develop.svn.wordpress.org/trunk@32916 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
75b6e0755d
commit
7192f7e9cf
@ -900,7 +900,7 @@ var Attachments = Backbone.Collection.extend({
|
|||||||
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
||||||
|
|
||||||
if ( _.isArray( type ) ) {
|
if ( _.isArray( type ) ) {
|
||||||
found = _.find( type, function (t) {
|
found = ! type.length || _.find( type, function (t) {
|
||||||
return -1 !== mime.indexOf( t );
|
return -1 !== mime.indexOf( t );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
|
@ -496,7 +496,7 @@ var Attachments = Backbone.Collection.extend({
|
|||||||
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
mime = atts.mime || ( atts.file && atts.file.type ) || '';
|
||||||
|
|
||||||
if ( _.isArray( type ) ) {
|
if ( _.isArray( type ) ) {
|
||||||
found = _.find( type, function (t) {
|
found = ! type.length || _.find( type, function (t) {
|
||||||
return -1 !== mime.indexOf( t );
|
return -1 !== mime.indexOf( t );
|
||||||
} );
|
} );
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user