From 7072d255c91047c19cf1ed916598561646a4667e Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Thu, 6 Feb 2014 23:51:51 +0300 Subject: [PATCH] Fixed a couple of bugs in Download task. Removed workarounds that are no longer necessary. --- tasks.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks.coffee b/tasks.coffee index e772ff0..40d53d9 100644 --- a/tasks.coffee +++ b/tasks.coffee @@ -43,8 +43,8 @@ this.refreshObject = (task, methodResponse, callback) -> ) else if task.session.subtask.name is 'getParameterValues' if methodResponse.faultcode? - # Ignore GetParameterValues errors. A workaround for the crappy Seewon devices. - methodResponse = {parameterList : {}} + task.fault = methodResponse + return callback(null, STATUS_FAULT) this.getParameterValues(task.session.subtask, methodResponse, (err, status, cwmpResponse, deviceUpdates) -> callback(err, status, cwmpResponse, deviceUpdates) @@ -247,8 +247,8 @@ this.addObject = (task, methodResponse, callback) -> task.session.appliedParameterValues.push([p1[0], v, t]) if methodResponse.faultcode? - # Ignore GetParameterValues errors. A workaround for the crappy Seewon devices. - methodResponse = {parameterList : {}} + task.fault = methodResponse + return callback(null, STATUS_FAULT) if status & STATUS_COMPLETED and task.session.appliedParameterValues.length > 0 task.session.subtask = {name : 'setParameterValues', parameterValues : task.session.appliedParameterValues} @@ -321,9 +321,9 @@ this.download = (task, methodResponse, callback) -> methodRequest = { type : 'Download', - fileType : file.metadata?.FileType ? '1 Firmware Upgrade Image', + fileType : file.metadata.fileType, fileSize : file.length, - url : "http://#{config.FILES_IP}:#{config.FILES_PORT}/#{file.filename}", + url : "http://#{config.FILES_IP}:#{config.FILES_PORT}/#{encodeURIComponent(file.filename)}", successUrl : task.successUrl, failureUrl : task.failureUrl }