Added option for downloading direct resource as attachment

pull/22/head
tycrek 3 years ago
parent 0e67b5c5c2
commit 66809f0876
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -56,6 +56,10 @@ router.get('/direct*', (req, res) => {
const { resourceId } = req.ass;
const fileData = data[resourceId];
// Send file as an attachement for downloads
if (req.query.download)
res.header('Content-Disposition', `attachment; filename="${fileData.originalname}"`);
// Return the file differently depending on what storage option was used
const uploaders = {
s3: () => fetch(getS3url(fileData.randomId, fileData.mimetype)).then((file) => {

Loading…
Cancel
Save