@@ -35,8 +35,8 @@ module.exports = function (options) {
3535 this . noCache ( ) ;
3636 var files = [ ] ;
3737 fs . readdir ( options . uploadDir ( ) , _ . bind ( function ( err , list ) {
38- async . each ( list , function ( name , cb ) {
39- fs . stat ( options . uploadDir ( ) + '/' + name , function ( err , stats ) {
38+ async . each ( list , _ . bind ( function ( name , cb ) {
39+ fs . stat ( options . uploadDir ( ) + '/' + name , _ . bind ( function ( err , stats ) {
4040 if ( ! err ) {
4141 if ( stats . isFile ( ) ) {
4242 fileInfo = new FileInfo ( {
@@ -51,8 +51,8 @@ module.exports = function (options) {
5151 }
5252 }
5353 cb ( err ) ;
54- } ) ;
55- } ,
54+ } , this ) ) ;
55+ } , this ) ,
5656 function ( err ) {
5757 if ( err ) console . log ( err ) ;
5858 this . callback ( { files : files } ) ;
@@ -70,15 +70,15 @@ module.exports = function (options) {
7070 redirect ,
7171 finish = _ . bind ( function ( ) {
7272 if ( ! -- counter ) {
73- async . each ( files , function ( fileInfo , cb ) {
74- this . initUrls ( fileInfo , function ( err ) {
73+ async . each ( files , _ . bind ( function ( fileInfo , cb ) {
74+ this . initUrls ( fileInfo , _ . bind ( function ( err ) {
7575 this . emit ( 'end' , fileInfo ) ;
7676 cb ( err ) ;
77- } ) ;
78- } ,
79- function ( err ) {
77+ } , this ) ) ;
78+ } , this ) ,
79+ _ . bind ( function ( err ) {
8080 this . callback ( { files : files } , redirect ) ;
81- } ) ;
81+ } , this ) ) ;
8282 }
8383 } , this ) ;
8484
0 commit comments