From 9519f6418da8fc07ae42ef1477c604cb181e5539 Mon Sep 17 00:00:00 2001 From: mfcar Date: Tue, 19 Sep 2023 22:37:57 +0100 Subject: [PATCH] Now, whenever someone requests a backup file, it will automatically suggest a default file name for the downloaded file. --- server/controllers/BackupController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/controllers/BackupController.js b/server/controllers/BackupController.js index f33624ac27..c578c63fa4 100644 --- a/server/controllers/BackupController.js +++ b/server/controllers/BackupController.js @@ -42,6 +42,9 @@ class BackupController { Logger.debug(`Use X-Accel to serve static file ${encodedURI}`) return res.status(204).header({ 'X-Accel-Redirect': encodedURI }).send() } + + res.setHeader('Content-disposition', 'attachment; filename=' + req.backup.filename) + res.sendFile(req.backup.fullPath) } @@ -65,4 +68,4 @@ class BackupController { next() } } -module.exports = new BackupController() \ No newline at end of file +module.exports = new BackupController()