From f834a3213c40b368310b990d3db4527525271aa7 Mon Sep 17 00:00:00 2001 From: Alicia Lopez Date: Tue, 26 Oct 2021 22:44:25 +0100 Subject: [PATCH] fix: update detection of changelog links (take 2) (#575) Underscores in the links to the changelogs are escaped for markdown links but not escaped for HTML links. --- lib/prepare_release.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/prepare_release.js b/lib/prepare_release.js index e00b94e..4eb7c5b 100644 --- a/lib/prepare_release.js +++ b/lib/prepare_release.js @@ -332,16 +332,18 @@ class ReleasePreparation { const arr = data.split('\n'); const major = versionComponents.major; - const hrefLink = `doc/changelogs/CHANGELOG\\_V${major}.md`; + const hrefLink = `doc/changelogs/CHANGELOG_V${major}.md`; + const escapedHrefLink = hrefLink.replace(/_/g, '\\_'); const newRefLink = `${newVersion}`; const lastRefLink = `${lastRef}`; for (let idx = 0; idx < arr.length; idx++) { if (isLTSTransition) { - if (arr[idx].includes(hrefLink)) { + if (arr[idx].includes(escapedHrefLink)) { + arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**'); + } else if (arr[idx].includes(hrefLink)) { const eolDate = getEOLDate(date); const eol = eolDate.toISOString().split('-').slice(0, 2).join('-'); - arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**'); arr[idx] = arr[idx].replace('"Current"', `"LTS Until ${eol}"`); arr[idx] = arr[idx].replace('Current', 'LTS'); } else if (arr[idx].includes('**Long Term Support**')) {