From fa251e27fd035f641de670a252a8707669dfb201 Mon Sep 17 00:00:00 2001 From: xicilion Date: Fri, 18 Oct 2024 02:37:00 +0800 Subject: [PATCH] check resource after injected. --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 70de25e..b58fe3e 100644 --- a/index.js +++ b/index.js @@ -111,6 +111,11 @@ module.exports.inject = function (filename, resourceName, resourceData, options) } const buffer = Buffer.from(data.buffer); + const checkResource = buffer.indexOf(resourceData); + if (checkResource === -1) { + throw new Error("Resource was not injected correctly"); + } + const firstSentinel = buffer.indexOf(sentinelFuse); if (firstSentinel === -1) {