From 47f7282a27fca8a60b8b8ba5d68465eb30a17f7f Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 17 Mar 2016 13:15:19 +0300 Subject: [PATCH] Fix regression bug in download task --- lib/tasks.coffee | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/tasks.coffee b/lib/tasks.coffee index 1b713d9..23447b3 100644 --- a/lib/tasks.coffee +++ b/lib/tasks.coffee @@ -335,12 +335,8 @@ this.download = (task, methodResponse, callback) -> callback(null, STATUS_OK, methodRequest) else db.filesCollection.findOne({_id : mongodb.ObjectID(String(task.file))}, (err, file) -> - if not file? - callback('File not found') - return - else if err? - callback(err) - return + if err or not file? + return callback(err or new Error('File not found')) l = { protocol : if config.get('FS_SSL') then 'https' else 'http',