🐛 correct favicon redirects with subdirectory (#8274)

refs #7688, #8221 

Use our url util `urlFor` to ensure, the redirect includes the subdirectory, if set up.
This commit is contained in:
Aileen Nowak 2017-04-05 21:28:52 +07:00 committed by Hannah Wolfe
parent 817b8d09ca
commit 581ff67499

View File

@ -45,7 +45,7 @@ function serveFavicon() {
if (settingsCache.get('icon')) {
// depends on the uploaded icon extension
if (originalExtension !== requestedExtension) {
return res.redirect(302, '/favicon' + originalExtension);
return res.redirect(302, utils.url.urlFor({relativeUrl: '/favicon' + originalExtension}));
}
storage.getStorage()
@ -66,7 +66,7 @@ function serveFavicon() {
// CASE: always redirect to .ico for default icon
if (originalExtension !== requestedExtension) {
return res.redirect(302, '/favicon.ico');
return res.redirect(302, utils.url.urlFor({relativeUrl: '/favicon.ico'}));
}
fs.readFile(filePath, function readFile(err, buf) {