diff --git a/lib/endpoints.js b/lib/endpoints.js index b39214c..184c7f3 100644 --- a/lib/endpoints.js +++ b/lib/endpoints.js @@ -86,6 +86,8 @@ app.get('/files/:fid', async(req, res, next) => { const format = req.params.fid.endsWith('.zip') ? 'zip' : 'tar.gz'; 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) { res.status(404).send(errorPage.replace('%%ERROR%%', 'Invalid link')); return;