Fix for issue #127
This commit is contained in:
parent
2104efe438
commit
a8fe32d78a
|
@ -5,6 +5,7 @@
|
|||
|
||||
var IncomingForm = require('formidable');
|
||||
var StringDecoder = require('string_decoder').StringDecoder;
|
||||
var path = require('path');
|
||||
|
||||
var defaultOptions = {
|
||||
maxFileSize: 10 * 1024 * 1024 // 10 MB
|
||||
|
@ -197,6 +198,7 @@ function handleError(res, err) {
|
|||
*/
|
||||
exports.download = function(provider, req, res, container, file, cb) {
|
||||
|
||||
var fileName = path.basename(file);
|
||||
var params = {
|
||||
container: container || req && req.params.container,
|
||||
remote: file || req && req.params.file
|
||||
|
@ -234,7 +236,7 @@ exports.download = function(provider, req, res, container, file, cb) {
|
|||
|
||||
var reader = provider.download(params);
|
||||
|
||||
res.type(file);
|
||||
res.type(fileName);
|
||||
|
||||
reader.pipe(res);
|
||||
reader.on('error', function(err) {
|
||||
|
@ -247,7 +249,7 @@ exports.download = function(provider, req, res, container, file, cb) {
|
|||
|
||||
var reader = provider.download(params);
|
||||
|
||||
res.type(file);
|
||||
res.type(fileName);
|
||||
|
||||
reader.pipe(res);
|
||||
reader.on('error', function(err) {
|
||||
|
|
Loading…
Reference in New Issue