Correctly use https scheme for download RPC when FS_SSL config is set. Fixes #43.
This commit is contained in:
1 parent
3625f26134
commit
2932b9ab6d
1 file changed
+9
-1
+9
-1
@@ -43,6 +43,7 @@ common = require './common'
|
|||||||
db = require './db'
|
db = require './db'
|
||||||
mongodb = require 'mongodb'
|
mongodb = require 'mongodb'
|
||||||
customCommands = require './custom-commands'
|
customCommands = require './custom-commands'
|
||||||
|
url = require 'url'
|
||||||
|
|
||||||
exports.STATUS_OK = STATUS_OK = 1
|
exports.STATUS_OK = STATUS_OK = 1
|
||||||
exports.STATUS_FAULT = STATUS_FAULT = 2
|
exports.STATUS_FAULT = STATUS_FAULT = 2
|
||||||
@@ -330,11 +331,18 @@ this.download = (task, methodResponse, callback) ->
|
|||||||
callback(err)
|
callback(err)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
l = {
|
||||||
|
protocol : if config.get('FS_SSL') then 'https' else 'http',
|
||||||
|
hostname : config.get('FS_IP'),
|
||||||
|
port : config.get('FS_PORT'),
|
||||||
|
pathname : encodeURIComponent(file.filename)
|
||||||
|
}
|
||||||
|
|
||||||
methodRequest = {
|
methodRequest = {
|
||||||
type : 'Download',
|
type : 'Download',
|
||||||
fileType : file.metadata.fileType,
|
fileType : file.metadata.fileType,
|
||||||
fileSize : file.length,
|
fileSize : file.length,
|
||||||
url : "http://#{config.get('FS_IP')}:#{config.get('FS_PORT')}/#{encodeURIComponent(file.filename)}",
|
url : url.format(l),
|
||||||
successUrl : task.successUrl,
|
successUrl : task.successUrl,
|
||||||
failureUrl : task.failureUrl
|
failureUrl : task.failureUrl
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user