Merge pull request #34 from timosaikkonen/master

Fix for issue #4
This commit is contained in:
Raymond Feng 2015-01-14 15:06:18 -08:00
commit 956383fd72
2 changed files with 11 additions and 0 deletions

View File

@ -118,9 +118,16 @@ exports.download = function (provider, req, res, container, file, cb) {
container: container || req && req.params.container,
remote: file || req && req.params.file
});
res.type(file);
reader.pipe(res);
reader.on('error', function (err) {
if (err.code === 'ENOENT') {
res.type('application/json');
res.send(404, { error: err });
return;
}
res.type('application/json');
res.send(500, { error: err });
});

View File

@ -92,6 +92,10 @@ StorageService.prototype.destroyContainer = function (container, cb) {
*/
StorageService.prototype.getContainer = function (container, cb) {
return this.client.getContainer(container, function (err, container) {
if (err && err.code === 'ENOENT') {
err.statusCode = err.status = 404;
return cb(err);
}
return cb(err, map(container));
});
};