From 51e47f0312b8c8abd407bb3904d894aaf64031ef Mon Sep 17 00:00:00 2001 From: checksum Date: Wed, 17 Jul 2024 21:55:21 -0500 Subject: [PATCH] fix: remove BOM from `manifest.json` if present --- src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 800fb6e..80becd4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -138,8 +138,16 @@ async function run(): Promise { : await findManifest(process.cwd()) if (manifestFile) { core.info(`Found manifest.json at ${manifestFile}`) - const manifest = JSON.parse(await fs.readFile(manifestFile, 'utf8')) + + let manifestStringData = await fs.readFile(manifestFile, 'utf-8') + if (manifestStringData.startsWith('\ufeff')) { + core.info('Removing BOM from manifest.json') + manifestStringData = manifestStringData.substring(1) + } + + const manifest = JSON.parse(manifestStringData) requestedVersion = manifest.gameVersion + core.info(`Inferred version: ${requestedVersion}`) } else { core.error('No manifest.json found and no version specified.')