mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
fix: don't copy if src doesn't exist
This commit is contained in:
@@ -11,8 +11,9 @@ module.exports = {
|
|||||||
method: async function () {
|
method: async function () {
|
||||||
const pathToIco = path.join(nconf.get('upload_path'), 'system', 'favicon.ico');
|
const pathToIco = path.join(nconf.get('upload_path'), 'system', 'favicon.ico');
|
||||||
const defaultIco = path.join(nconf.get('base_dir'), 'public', 'favicon.ico');
|
const defaultIco = path.join(nconf.get('base_dir'), 'public', 'favicon.ico');
|
||||||
const exists = await file.exists(pathToIco);
|
const targetExists = await file.exists(pathToIco);
|
||||||
if (!exists) {
|
const defaultExists = await file.exists(defaultIco);
|
||||||
|
if (defaultExists && !targetExists) {
|
||||||
await fs.promises.copyFile(defaultIco, pathToIco);
|
await fs.promises.copyFile(defaultIco, pathToIco);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user