Skip to content

Commit 0f68596

Browse files
committed
Escape string in regex using library
1 parent f0728b2 commit 0f68596

File tree

1 file changed

+1
-1
lines changed
  • packages/remark-lsx/src/server/routes/list-pages

1 file changed

+1
-1
lines changed

packages/remark-lsx/src/server/routes/list-pages/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const listPages = ({ excludedPaths }: { excludedPaths: string[] }) => {
9595
if (excludedPaths.length > 0) {
9696
const escapedPaths = excludedPaths.map((p) => {
9797
const cleanPath = p.startsWith('/') ? p.substring(1) : p;
98-
return cleanPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
98+
return escapeStringRegexp(cleanPath);
9999
});
100100

101101
const regex = new RegExp(`^\\/(${escapedPaths.join('|')})(\\/|$)`);

0 commit comments

Comments
 (0)