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 committed 2016-02-19 18:45:21 +00:00
1 parent 2aaec7bde5
commit cfc04ee77a
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')