Skip to content

Node.js based forum software built for the modern web

fix test

Barış Soner Uşaklı18ba08183c2a
diff --git a/src/middleware/index.js b/src/middleware/index.js
index cb91f82339..c0cce7623a 100644
--- a/src/middleware/index.js
+++ b/src/middleware/index.js
@@ -99,13 +99,14 @@ middleware.routeTouchIcon = function (req, res) {
if (meta.config['brand:touchIcon'] && validator.isURL(meta.config['brand:touchIcon'])) {
return res.redirect(meta.config['brand:touchIcon']);
}
- var iconPath = '../../public';
+ var iconPath = '';
if (meta.config['brand:touchIcon']) {
- iconPath += meta.config['brand:touchIcon'].replace(/assets\/uploads/, 'uploads');
+ iconPath = path.join(nconf.get('upload_path'), meta.config['brand:touchIcon'].replace(/assets\/uploads/, ''));
} else {
- iconPath += '/logo.png';
+ iconPath = path.join(nconf.get('base_dir'), 'public/logo.png');
}
- return res.sendFile(path.join(__dirname, iconPath), {
+
+ return res.sendFile(iconPath, {
maxAge: req.app.enabled('cache') ? 5184000000 : 0,
});
};