From bb792e0558354cc786c5e5e23c3dd34fc79f278d Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Thu, 24 Sep 2026 15:44:15 +0200 Subject: [PATCH] fix(flatpak): read the changelog date without building a regex from input --- scripts/flatpak-metainfo-release.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/flatpak-metainfo-release.js b/scripts/flatpak-metainfo-release.js index c8a4bb2e0..22e724fc4 100644 --- a/scripts/flatpak-metainfo-release.js +++ b/scripts/flatpak-metainfo-release.js @@ -15,9 +15,12 @@ if (!version || !/^\d+\.\d+\.\d+/.test(version)) { } const changelog = readFileSync('CHANGELOG.md', 'utf8'); -const date = changelog.match( - new RegExp(`\\n## ${version.replaceAll('.', '\\.')} \\((\\d{4}-\\d{2}-\\d{2})\\)`) -)?.[1]; +const heading = `\n## ${version} (`; +const start = changelog.indexOf(heading); +const date = + start === -1 + ? undefined + : changelog.slice(start + heading.length).match(/^(\d{4}-\d{2}-\d{2})\)/)?.[1]; if (!date) { console.error(`No "## ${version} (YYYY-MM-DD)" section in CHANGELOG.md`); process.exit(1);