File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -292,16 +292,18 @@ req.flash = function(type, msg){
292292req . is = function ( type ) {
293293 var fn = this . app . is ( type ) ;
294294 if ( fn ) return fn ( this ) ;
295- var contentType = this . headers [ 'content-type' ] ;
296- if ( ! contentType ) return ;
295+ var ct = this . headers [ 'content-type' ] ;
296+ if ( ! ct ) return false ;
297+ ct = ct . split ( ';' ) [ 0 ] ;
297298 if ( ! ~ type . indexOf ( '/' ) ) type = mime . lookup ( type ) ;
298299 if ( ~ type . indexOf ( '*' ) ) {
299- type = type . split ( '/' )
300- contentType = contentType . split ( '/' ) ;
301- if ( '*' == type [ 0 ] && type [ 1 ] == contentType [ 1 ] ) return true ;
302- if ( '*' == type [ 1 ] && type [ 0 ] == contentType [ 0 ] ) return true ;
300+ type = type . split ( '/' ) ;
301+ ct = ct . split ( '/' ) ;
302+ if ( '*' == type [ 0 ] && type [ 1 ] == ct [ 1 ] ) return true ;
303+ if ( '*' == type [ 1 ] && type [ 0 ] == ct [ 0 ] ) return true ;
304+ return false ;
303305 }
304- return ! ! ~ contentType . indexOf ( type ) ;
306+ return ! ! ~ ct . indexOf ( type ) ;
305307} ;
306308
307309// Callback for isXMLHttpRequest / xhr
You can’t perform that action at this time.
0 commit comments