diff --git a/lib/index-web.js b/lib/index-web.js index b4947d823..547eaa3a2 100644 --- a/lib/index-web.js +++ b/lib/index-web.js @@ -45,11 +45,11 @@ module.exports = function(config, auth, storage) { // Static app.get('/-/static/:filename', function(req, res, next) { var file = __dirname + '/static/' + req.params.filename - fs.exists(file, function(exists) { - if (exists) { - res.sendfile(file) + res.sendfile(file, function(err) { + if (err.status === 404) { + next() } else { - next( Error[404]('File Not Found') ) + next(err) } }) }) diff --git a/lib/index.js b/lib/index.js index 9bf4f86cc..1d5873d4a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -415,6 +415,9 @@ module.exports = function(config_hash) { res.report_error(err) }) + app.get('/*', function(req, res, next) { + next( Error[404]('file not found') ) + }) return app }