Skip to content

Commit

Permalink
Now, whenever someone requests a backup file, it will automatically s…
Browse files Browse the repository at this point in the history
…uggest a default file name for the downloaded file.
  • Loading branch information
mfcar committed Sep 19, 2023
1 parent 9967a5d commit 9519f64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/controllers/BackupController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -65,4 +68,4 @@ class BackupController {
next()
}
}
module.exports = new BackupController()
module.exports = new BackupController()

0 comments on commit 9519f64

Please sign in to comment.