From 9d3756b9fd4b4c49317636c361038093c24b620c Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Fri, 13 May 2022 07:17:13 +0200 Subject: [PATCH 1/2] fix(changelog): massage links case insensitive Closes #14804 --- lib/modules/platform/github/massage-markdown-links.spec.ts | 1 + lib/modules/platform/github/massage-markdown-links.ts | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/platform/github/massage-markdown-links.spec.ts b/lib/modules/platform/github/massage-markdown-links.spec.ts index 93564ab31a3945..0f24fff9e7096a 100644 --- a/lib/modules/platform/github/massage-markdown-links.spec.ts +++ b/lib/modules/platform/github/massage-markdown-links.spec.ts @@ -62,6 +62,7 @@ describe('modules/platform/github/massage-markdown-links', () => { ${'github.com/foo/bar/discussions/1'} | ${'[github.com/foo/bar/discussions/1](togithub.com/foo/bar/discussions/1)'} ${'github.com/foo/bar/issues/1'} | ${'[github.com/foo/bar/issues/1](togithub.com/foo/bar/issues/1)'} ${'github.com/foo/bar/pull/1'} | ${'[github.com/foo/bar/pull/1](togithub.com/foo/bar/pull/1)'} + ${'github.com/Foo/bar/pull/1'} | ${'[github.com/Foo/bar/pull/1](togithub.com/Foo/bar/pull/1)'} ${'www.github.com/foo/bar/discussions/1'} | ${'[www.github.com/foo/bar/discussions/1](www.togithub.com/foo/bar/discussions/1)'} ${'www.github.com/foo/bar/issues/1'} | ${'[www.github.com/foo/bar/issues/1](www.togithub.com/foo/bar/issues/1)'} ${'www.github.com/foo/bar/pull/1'} | ${'[www.github.com/foo/bar/pull/1](www.togithub.com/foo/bar/pull/1)'} diff --git a/lib/modules/platform/github/massage-markdown-links.ts b/lib/modules/platform/github/massage-markdown-links.ts index c55a1eba8e1528..e4323f0c274fc8 100644 --- a/lib/modules/platform/github/massage-markdown-links.ts +++ b/lib/modules/platform/github/massage-markdown-links.ts @@ -22,7 +22,6 @@ function collectLinkPosition(input: string, matches: UrlMatch[]): Plugin { const transformer = (tree: Content): void => { const startOffset: number = tree.position?.start.offset ?? 0; const endOffset: number = tree.position?.end.offset ?? 0; - if (tree.type === 'link') { const substr = input.slice(startOffset, endOffset); const url: string = tree.url; @@ -35,7 +34,7 @@ function collectLinkPosition(input: string, matches: UrlMatch[]): Plugin { }); } } else if (tree.type === 'text') { - const globalUrlReg = new RegExp(urlRegex, 'g'); + const globalUrlReg = new RegExp(urlRegex, 'gi'); const urlMatches = [...tree.value.matchAll(globalUrlReg)]; for (const match of urlMatches) { const [url] = match; From 95db9dbb5009ef1f6faec9b679a89c46e6f700c2 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Fri, 13 May 2022 07:18:34 +0200 Subject: [PATCH 2/2] revert white space change --- lib/modules/platform/github/massage-markdown-links.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/modules/platform/github/massage-markdown-links.ts b/lib/modules/platform/github/massage-markdown-links.ts index e4323f0c274fc8..15b0ba3a81d3d1 100644 --- a/lib/modules/platform/github/massage-markdown-links.ts +++ b/lib/modules/platform/github/massage-markdown-links.ts @@ -22,6 +22,7 @@ function collectLinkPosition(input: string, matches: UrlMatch[]): Plugin { const transformer = (tree: Content): void => { const startOffset: number = tree.position?.start.offset ?? 0; const endOffset: number = tree.position?.end.offset ?? 0; + if (tree.type === 'link') { const substr = input.slice(startOffset, endOffset); const url: string = tree.url;