From 1a04e75e8bdc62f36ae63095e3b1bd8d0aaced30 Mon Sep 17 00:00:00 2001
From: Daniel Lockyer <hi@daniellockyer.com>
Date: Mon, 27 Feb 2023 17:48:41 +0100
Subject: [PATCH] Set backup file encoding as `utf8`

- we write files in the default encoding (which is `utf8`) and this
  files a types issue with `JSON.parse` operating on a Buffer
---
 ghost/core/core/server/data/db/backup.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ghost/core/core/server/data/db/backup.js b/ghost/core/core/server/data/db/backup.js
index c39e4258da..8153d1a3ce 100644
--- a/ghost/core/core/server/data/db/backup.js
+++ b/ghost/core/core/server/data/db/backup.js
@@ -31,7 +31,7 @@ const readBackup = async (filename) => {
     const exists = await fs.pathExists(backupPath);
 
     if (exists) {
-        const backupFile = await fs.readFile(backupPath);
+        const backupFile = await fs.readFile(backupPath, 'utf8');
         return JSON.parse(backupFile);
     } else {
         return null;