Skip to content

Commit

Permalink
fix: #9462, on install copy default favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Apr 6, 2021
1 parent 05f2236 commit 784600d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,22 @@ async function setCopyrightWidget() {
}
}

async function copyFavicon() {
const file = require('./file');
const pathToIco = path.join(nconf.get('upload_path'), 'system', 'favicon.ico');
const defaultIco = path.join(nconf.get('base_dir'), 'public', 'favicon.ico');
const targetExists = await file.exists(pathToIco);
const defaultExists = await file.exists(defaultIco);

if (defaultExists && !targetExists) {
try {
await fs.promises.copyFile(defaultIco, pathToIco);
} catch (err) {
winston.error(`Cannot copy favicon.ico\n${err.stack}`);
}
}
}

async function checkUpgrade() {
const upgrade = require('./upgrade');
try {
Expand Down Expand Up @@ -492,6 +508,7 @@ install.setup = async function () {
await createWelcomePost();
await enableDefaultPlugins();
await setCopyrightWidget();
await copyFavicon();
await checkUpgrade();

const data = {
Expand Down

0 comments on commit 784600d

Please sign in to comment.