specialpages: replace relative paths for sendfile() with absolute ones

This file uses it for robots.txt and favicon.ico.

This makes use of the new stable settings.root introduced with #3466, and will
be modified when introducing support for custom skins.
pull/3473/head
muxator 2018-08-23 23:39:38 +02:00
parent 9db5fd7884
commit d1481041c2
1 changed files with 5 additions and 4 deletions

View File

@ -26,13 +26,13 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//serve robots.txt
args.app.get('/robots.txt', function(req, res)
{
var filePath = path.normalize(__dirname + "/../../../static/custom/robots.txt");
var filePath = path.join(settings.root, "src", "static", "custom", "robots.txt");
res.sendFile(filePath, function(err)
{
//there is no custom favicon, send the default robots.txt which dissallows all
if(err)
{
filePath = path.normalize(__dirname + "/../../../static/robots.txt");
filePath = path.join(settings.root, "src", "static", "robots.txt");
res.sendFile(filePath);
}
});
@ -79,13 +79,14 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//serve favicon.ico from all path levels except as a pad name
args.app.get( /\/favicon.ico$/, function(req, res)
{
var filePath = path.normalize(__dirname + "/../../../static/custom/favicon.ico");
var filePath = path.join(settings.root, "src", "static", "custom", "favicon.ico");
res.sendFile(filePath, function(err)
{
//there is no custom favicon, send the default favicon
if(err)
{
filePath = path.normalize(__dirname + "/../../../static/favicon.ico");
filePath = path.join(settings.root, "src", "static", "favicon.ico");
res.sendFile(filePath);
}
});