Skip to content

Commit b97e921

Browse files
committed
fix duplicated call of callback
1 parent e36b88a commit b97e921

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/uploadhandler.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,18 @@ module.exports = function (options) {
3737
fs.readdir(options.uploadDir(), _.bind(function (err, list) {
3838
async.each(list, _.bind(function(name, cb) {
3939
fs.stat(options.uploadDir() + '/' + name, _.bind(function(err, stats) {
40-
if (!err) {
41-
if (stats.isFile()) {
42-
fileInfo = new FileInfo({
43-
name: name,
44-
size: stats.size
45-
});
46-
this.initUrls(fileInfo, function(err) {
47-
files.push(fileInfo);
48-
cb(err);
49-
return;
50-
});
51-
}
40+
if (!err && stats.isFile()) {
41+
fileInfo = new FileInfo({
42+
name: name,
43+
size: stats.size
44+
});
45+
this.initUrls(fileInfo, function(err) {
46+
files.push(fileInfo);
47+
cb(err);
48+
return;
49+
});
5250
}
53-
cb(err);
51+
else cb(err);
5452
}, this));
5553
}, this),
5654
function(err) {

0 commit comments

Comments
 (0)