Skip to content

Commit

Permalink
Merge pull request #168 from ritishgumber/master
Browse files Browse the repository at this point in the history
bug fixes
  • Loading branch information
nawazdhandala authored Apr 27, 2017
2 parents 7620f37 + a60407b commit ee5c2e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
36 changes: 18 additions & 18 deletions api/app/AppFiles.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@

/*
# CloudBoost - Core Engine that powers Bakend as a Service
# (c) 2014 HackerBay, Inc.
# (c) 2014 HackerBay, Inc.
# CloudBoost may be freely distributed under the Apache 2 License
*/

module.exports = function() {
module.exports = function() {

//get file from gridfs
global.app.get('/appfile/:appId/icon', function (req, res) {
global.app.get('/appfile/:appId/icon', function(req, res) {

console.log("++++ Stream file from gridfs++++++");

var appId = req.params.appId;
var fileName = appId;
var fileName = appId;

global.mongoService.document.getFile(appId,fileName).then(function(file){
global.mongoService.document.getFile(appId, fileName).then(function(file) {
if (!file)
res.send();

var fileStream=global.mongoService.document.getFileStreamById(appId,file._id);
var fileStream = global.mongoService.document.getFileStreamById(appId, file._id);

res.set('Content-Type', file.contentType);
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');

fileStream.on("error", function(err) {
res.send(500, "Got error while processing stream " + err.message);
res.end();
});

fileStream.on("error", function(err) {
res.send(500, "Got error while processing stream " + err.message);
res.end();
});

fileStream.on('end', function() {
res.end();
res.end();
});

fileStream.pipe(res);

},function(error){
}, function(error) {
return res.status(500).send(error);
});
});

});
}

}
8 changes: 4 additions & 4 deletions database-connect/keys.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

/*
# CloudBoost - Core Engine that powers Bakend as a Service
# (c) 2014 HackerBay, Inc.
# (c) 2014 HackerBay, Inc.
# CloudBoost may be freely distributed under the Apache 2 License
*/


module.exports = function (){
return {
//Defaults.
//Defaults.
appExpirationTimeFromCache: 86400,
cacheAppPrefix : 'app',
cacheSchemaPrefix: 'schema',
schemaExpirationTimeFromCache: 86400,
analyticsUrl: 'https://analytics.cloudboost.io',
schemaExpirationTimeFromCache: 86400,
analyticsUrl: 'https://cluster-analytics.cloudboost.io',
globalDb : "_GLOBAL",
globalSettings : "_Settings",
analyticsKey : "109eb359-3d22-4165-9e21-21439637f975",
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ global.app.use([

var appId = req.params.appId;
if (!appKey) {
return res.status(401).send("Error : Key not found.");
return res.status(401).send({status: 'error', message: 'Key not found. You need to have your Client Key or Master Key in the <> header when you make this request'});
} else {
console.log("check if app is in the plan");
//check if app is in the plan.
Expand Down

0 comments on commit ee5c2e5

Please sign in to comment.