fix #185
This commit is contained in:
@@ -91,8 +91,12 @@ module.exports = {
|
||||
const router = express.Router()
|
||||
// serve images/thumb
|
||||
router.use('/media/', express.static(config.upload_path, { immutable: true, maxAge: '1y' }), (_req, res) => res.sendStatus(404))
|
||||
router.use('/download/:filename', (req, res, next) => {
|
||||
return res.download(req.params.filename, undefined, { root: config.upload_path }, err => res.status(404).send('Not found (but nice try 😊)'))
|
||||
router.use('/download/:filename', (req, res) => {
|
||||
return res.download(req.params.filename, undefined, { root: config.upload_path }, err => {
|
||||
if (err) {
|
||||
res.status(404).send('Not found (but nice try 😊)')
|
||||
}
|
||||
})
|
||||
})
|
||||
router.use('/noimg.svg', express.static('./static/noimg.svg'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user