Skip to content

Commit

Permalink
feat: copy default favicon if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Mar 10, 2021
1 parent a9b33ed commit 754283d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/upgrades/1.17.0/default_favicon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const nconf = require('nconf');
const path = require('path');
const fs = require('fs');
const file = require('../../file');

module.exports = {
name: 'Store default favicon if it does not exist',
timestamp: Date.UTC(2021, 2, 9),
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) {
await fs.promises.copyFile(defaultIco, pathToIco);
}
},
};

0 comments on commit 754283d

Please sign in to comment.