This commit is contained in:
Danny Coates
2017-06-29 10:30:08 -07:00
parent 05fe534e14
commit 67f586b65c
6 changed files with 40 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
const conf = require('./config.js');
const isProduction = conf.env === 'production'
const isProduction = conf.env === 'production';
const mozlog = require('mozlog')({
app: 'FirefoxFileshare',

View File

@@ -78,10 +78,10 @@ app.get('/assets/download/:id', (req, res) => {
return;
}
storage.metadata(id)
storage
.metadata(id)
.then(meta => {
storage.length(id).then(contentLength => {
res.writeHead(200, {
'Content-Disposition': 'attachment; filename=' + meta.filename,
'Content-Type': 'application/octet-stream',
@@ -142,7 +142,7 @@ app.post('/upload/:id', (req, res, next) => {
return;
}
const meta = JSON.parse(req.header('X-File-Metadata'));
log.info('meta', meta)
log.info('meta', meta);
req.pipe(req.busboy);
req.busboy.on('file', (fieldname, file, filename) => {
@@ -157,8 +157,6 @@ app.post('/upload/:id', (req, res, next) => {
});
});
});
});
app.get('/__lbheartbeat__', (req, res) => {

View File

@@ -58,8 +58,8 @@ function metadata(id) {
} else {
reject(err);
}
})
})
});
});
}
function filename(id) {
@@ -98,8 +98,8 @@ function aad(id) {
} else {
reject();
}
})
})
});
});
}
function localLength(id) {