Fix: handle zip-download for not existing bundle
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user