Skip to content

Node.js based forum software built for the modern web

fix another crash

Barış Soner Uşaklı03b047bd59cc
diff --git a/src/routes/index.js b/src/routes/index.js
index 1b08d42020..8efdc1f2a7 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -174,7 +174,7 @@ function handle404(app, middleware) {
res.type('text/javascript').status(200).send('');
} else if (isLanguage.test(req.url)) {
res.status(200).json({});
- } else if (req.path.startsWith(relativePath + '/uploads') || req.get('accept').indexOf('text/html') === -1 || req.path === '/favicon.ico') {
+ } else if (req.path.startsWith(relativePath + '/uploads') || (req.get('accept') && req.get('accept').indexOf('text/html') === -1) || req.path === '/favicon.ico') {
res.sendStatus(404);
} else if (req.accepts('html')) {
if (process.env.NODE_ENV === 'development') {