Skip to content

Commit

Permalink
wrong initial tag database
Browse files Browse the repository at this point in the history
  • Loading branch information
BluDood committed Nov 5, 2022
1 parent 9ef40c9 commit 0b16665
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const fs = require('fs')

function ensureDatabase() {
const exists = fs.existsSync('./databases/tags.json')
if (!exists) fs.writeFileSync('./databases/tags.json', '[]')
if (!exists) fs.writeFileSync('./databases/tags.json', '{}')
try {
JSON.parse(fs.readFileSync('./databases/tags.json'))
} catch {
fs.writeFileSync('./databases/tags.bak.json', fs.readFileSync('./databases/tags.json'))
console.log('Your tags database was corrupted, so we had to reset it. You can find a backup in ./databases/tags.bak.json')
fs.writeFileSync('./databases/tags.json', '[]')
fs.writeFileSync('./databases/tags.json', '{}')
}
}

Expand Down

0 comments on commit 0b16665

Please sign in to comment.