mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Fixed favicon not being loaded from url. (#6113)
* Fixed favicon not being loaded from url. * Fixed tests.
This commit is contained in:
parent
1a61994c61
commit
9e2c4bf781
2 changed files with 16 additions and 0 deletions
|
@ -43,6 +43,16 @@ exports.expressPreSession = async (hookName, {app}) => {
|
|||
|
||||
app.get('/favicon.ico', (req, res, next) => {
|
||||
(async () => {
|
||||
/*
|
||||
If this is a url we simply redirect to that one.
|
||||
*/
|
||||
if (settings.favicon && settings.favicon.startsWith('http')) {
|
||||
res.redirect(settings.favicon);
|
||||
res.send();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const fns = [
|
||||
...(settings.favicon ? [path.resolve(settings.root, settings.favicon)] : []),
|
||||
path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'favicon.ico'),
|
||||
|
|
|
@ -51,6 +51,12 @@ describe(__filename, function () {
|
|||
assert(gotIcon.equals(wantCustomIcon));
|
||||
});
|
||||
|
||||
it('uses custom favicon from url', async function () {
|
||||
settings.favicon = 'https://etherpad.org/favicon.ico';
|
||||
await agent.get('/favicon.ico')
|
||||
.expect(302);
|
||||
});
|
||||
|
||||
it('uses custom favicon if set (absolute pathname)', async function () {
|
||||
settings.favicon = path.join(__dirname, 'favicon-test-custom.png');
|
||||
assert(path.isAbsolute(settings.favicon));
|
||||
|
|
Loading…
Reference in a new issue