fix: remember to set lastIndex = 0 on shared RegExp (#918)

I had not observed an issue in the wild because of this yet, but it
feels like it was only a matter of time...
This commit is contained in:
Michael Bolin
2025-05-13 12:01:06 -07:00
committed by GitHub
parent 557f608f25
commit dd354e2134

View File

@@ -330,6 +330,7 @@ function rewriteFileCitations(
return markdown;
}
citationRegex.lastIndex = 0;
return markdown.replace(citationRegex, (_match, file, start, _end) => {
const absPath = path.resolve(cwd, file);
const uri = `${fileOpener}://file${absPath}:${start}`;