Skip to content

Commit

Permalink
fix(changelog): massage links case insensitive
Browse files Browse the repository at this point in the history
Closes #14804
  • Loading branch information
rarkins committed May 13, 2022
1 parent 098d22d commit 9d3756b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/modules/platform/github/massage-markdown-links.spec.ts
Expand Up @@ -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)'}
Expand Down
3 changes: 1 addition & 2 deletions lib/modules/platform/github/massage-markdown-links.ts
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 9d3756b

Please sign in to comment.