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:
@@ -330,6 +330,7 @@ function rewriteFileCitations(
|
|||||||
return markdown;
|
return markdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
citationRegex.lastIndex = 0;
|
||||||
return markdown.replace(citationRegex, (_match, file, start, _end) => {
|
return markdown.replace(citationRegex, (_match, file, start, _end) => {
|
||||||
const absPath = path.resolve(cwd, file);
|
const absPath = path.resolve(cwd, file);
|
||||||
const uri = `${fileOpener}://file${absPath}:${start}`;
|
const uri = `${fileOpener}://file${absPath}:${start}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user