From ebccc7940b449dbfdad2cd5237b59634d10097ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 10 Mar 2021 08:01:43 -0500 Subject: [PATCH] fix: don't copy if src doesn't exist --- src/upgrades/1.17.0/default_favicon.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/upgrades/1.17.0/default_favicon.js b/src/upgrades/1.17.0/default_favicon.js index 5f6196c874..8ebc14dd00 100644 --- a/src/upgrades/1.17.0/default_favicon.js +++ b/src/upgrades/1.17.0/default_favicon.js @@ -11,8 +11,9 @@ module.exports = { method: async function () { const pathToIco = path.join(nconf.get('upload_path'), 'system', 'favicon.ico'); const defaultIco = path.join(nconf.get('base_dir'), 'public', 'favicon.ico'); - const exists = await file.exists(pathToIco); - if (!exists) { + const targetExists = await file.exists(pathToIco); + const defaultExists = await file.exists(defaultIco); + if (defaultExists && !targetExists) { await fs.promises.copyFile(defaultIco, pathToIco); } },