Allow downloads from arbitrary URLS

If the download task contains a 'url', instruct the device to download
from that URL instead of genieacs-fs.
This commit is contained in:
Richard Platel authored and Zaid Abdulla committed 2016-03-07 02:45:43 +03:00
1 parent 4284fded99
commit 650efa9bec
1 file changed
+12
+12
View File
@@ -322,6 +322,18 @@ this.download = (task, methodResponse, callback) ->
return
if methodResponse.type isnt 'DownloadResponse'
if task.url?
methodRequest = {
type : 'Download',
fileType : task.fileType or '1 Firmware Upgrade Image',
url : task.url,
username: task.username,
password: task.password,
successUrl : task.successUrl,
failureUrl : task.failureUrl
}
callback(null, STATUS_OK, methodRequest)
else
db.filesCollection.findOne({_id : mongodb.ObjectID(String(task.file))}, (err, file) ->
if not file?
callback('File not found')