Fix: handle zip-download for not existing bundle

This commit is contained in:
Christoph Wiechert
2017-05-07 23:15:31 +02:00
parent 5739664049
commit 7ee6e80fda

View File

@@ -86,6 +86,8 @@ app.get('/files/:fid', async(req, res, next) => {
const format = req.params.fid.endsWith('.zip') ? 'zip' : 'tar.gz'; const format = req.params.fid.endsWith('.zip') ? 'zip' : 'tar.gz';
const bucket = db.get(sid); const bucket = db.get(sid);
if(!bucket) return res.status(404).send(errorPage.replace('%%ERROR%%', 'Download bucket not found.'));
if(req.params.fid !== sid + '++' + MD5(bucket.map(f => f.key).join()).toString() + '.' + format) { if(req.params.fid !== sid + '++' + MD5(bucket.map(f => f.key).join()).toString() + '.' + format) {
res.status(404).send(errorPage.replace('%%ERROR%%', 'Invalid link')); res.status(404).send(errorPage.replace('%%ERROR%%', 'Invalid link'));
return; return;