From a8fe32d78ad6c2e01961f62873da928b412df826 Mon Sep 17 00:00:00 2001 From: Gary Torres Date: Tue, 14 Jun 2016 11:20:24 -0600 Subject: [PATCH] Fix for issue #127 --- lib/storage-handler.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/storage-handler.js b/lib/storage-handler.js index 63a8db9..dd0d2a5 100644 --- a/lib/storage-handler.js +++ b/lib/storage-handler.js @@ -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 @@ -196,7 +197,8 @@ function handleError(res, err) { * @header storageService.download(provider, req, res, container, file, cb) */ 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) {