From 891553ac337f415c9a09eb52de477339f90f14bd Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Mon, 28 Jul 2025 16:20:44 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/scripts/link-extractor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/scripts/link-extractor.js b/.github/scripts/link-extractor.js index 097547f5e..616f7527d 100644 --- a/.github/scripts/link-extractor.js +++ b/.github/scripts/link-extractor.js @@ -94,9 +94,13 @@ function extractMarkdownLinks(content, filePath) { } // Bare URLs (basic detection, avoid false positives) - const bareUrlRegex = /(?:^|[\s\n])(https?:\/\/[^\s\)\]\}]+)/g; + // Regex to match bare URLs in text + // - (?:^|[\s\n]): Match the start of the line or any whitespace character + // - (https?:\/\/): Match the protocol (http or https) followed by :// + // - [^\s\)\]\}]+: Match the rest of the URL, stopping at spaces or closing characters like ), ], or } + const bareUrlRegex = /(?^|[\s\n])(?https?:\/\/[^\s\)\]\}]+)/g; while ((match = bareUrlRegex.exec(line)) !== null) { - const url = match[1]; + const url = match.groups.url; const columnStart = match.index + match[0].length - url.length; // Skip if this URL is already captured in a proper markdown link