fix: dont use oldField as regex to replace to newField

This commit is contained in:
ernisto 2025-04-25 15:03:08 -03:00
parent 9c83137753
commit 07a8d04523

View file

@ -146,13 +146,16 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
-- New version field string: -- New version field string:
local newField = string.gsub(serde.encode("toml", { version = stripLeadingVersion(newVersion) }), "%s+$", "") local newField = string.gsub(serde.encode("toml", { version = stripLeadingVersion(newVersion) }), "%s+$", "")
local updatedManifest = string.gsub( local updatedManifest, replaces = string.gsub(
manifestContents, manifestContents,
oldField, string.gsub(oldField, "[%.%+%-]", "%%%0"),
newField, newField,
-- Only replace the first occurrence to be safe -- Only replace the first occurrence to be safe
1 1
) )
if replaces == 0 then
error("failed to replace version field in manifest")
end
local toWrite = table.find(process.args, "--yes") local toWrite = table.find(process.args, "--yes")
or table.find(process.args, "-y") or table.find(process.args, "-y")