Skip to content

Commit ee5c2e5

Browse files
Merge pull request #168 from ritishgumber/master
bug fixes
2 parents 7620f37 + a60407b commit ee5c2e5

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

api/app/AppFiles.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
21
/*
32
# CloudBoost - Core Engine that powers Bakend as a Service
4-
# (c) 2014 HackerBay, Inc.
3+
# (c) 2014 HackerBay, Inc.
54
# CloudBoost may be freely distributed under the Apache 2 License
65
*/
76

8-
module.exports = function() {
7+
module.exports = function() {
98

109
//get file from gridfs
11-
global.app.get('/appfile/:appId/icon', function (req, res) {
10+
global.app.get('/appfile/:appId/icon', function(req, res) {
1211

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

1514
var appId = req.params.appId;
16-
var fileName = appId;
15+
var fileName = appId;
1716

18-
global.mongoService.document.getFile(appId,fileName).then(function(file){
17+
global.mongoService.document.getFile(appId, fileName).then(function(file) {
18+
if (!file)
19+
res.send();
1920

20-
var fileStream=global.mongoService.document.getFileStreamById(appId,file._id);
21+
var fileStream = global.mongoService.document.getFileStreamById(appId, file._id);
2122

2223
res.set('Content-Type', file.contentType);
23-
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');
24+
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');
25+
26+
fileStream.on("error", function(err) {
27+
res.send(500, "Got error while processing stream " + err.message);
28+
res.end();
29+
});
2430

25-
fileStream.on("error", function(err) {
26-
res.send(500, "Got error while processing stream " + err.message);
27-
res.end();
28-
});
29-
3031
fileStream.on('end', function() {
31-
res.end();
32+
res.end();
3233
});
3334

3435
fileStream.pipe(res);
3536

36-
},function(error){
37+
}, function(error) {
3738
return res.status(500).send(error);
38-
});
39+
});
3940

4041
});
41-
}
42-
42+
}

database-connect/keys.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

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

88

99
module.exports = function (){
1010
return {
11-
//Defaults.
11+
//Defaults.
1212
appExpirationTimeFromCache: 86400,
1313
cacheAppPrefix : 'app',
1414
cacheSchemaPrefix: 'schema',
15-
schemaExpirationTimeFromCache: 86400,
16-
analyticsUrl: 'https://analytics.cloudboost.io',
15+
schemaExpirationTimeFromCache: 86400,
16+
analyticsUrl: 'https://cluster-analytics.cloudboost.io',
1717
globalDb : "_GLOBAL",
1818
globalSettings : "_Settings",
1919
analyticsKey : "109eb359-3d22-4165-9e21-21439637f975",

server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ global.app.use([
192192

193193
var appId = req.params.appId;
194194
if (!appKey) {
195-
return res.status(401).send("Error : Key not found.");
195+
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'});
196196
} else {
197197
console.log("check if app is in the plan");
198198
//check if app is in the plan.

0 commit comments

Comments
 (0)