Merge pull request #133 from rplatel/download-arbitrary-url

Allow downloads from arbitrary URLS
This commit is contained in:
Zaid Abdulla committed 2016-02-24 01:44:09 +03:00
commit 7606d25e4b
1 file changed
+12
+12
View File
@@ -322,6 +322,18 @@ this.download = (task, methodResponse, callback) ->
return return
if methodResponse.type isnt 'DownloadResponse' 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) -> db.filesCollection.findOne({_id : mongodb.ObjectID(String(task.file))}, (err, file) ->
if not file? if not file?
callback('File not found') callback('File not found')