Skip to content

Commit

Permalink
Fix regex vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Nov 22, 2024
1 parent 0225fa1 commit 20248b8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/slugify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ export const slugify = (str: string): string => {
return str
.toLowerCase()
.replace(/&/g, "and")
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+/g, "")
.replace(/-+$/g, "");
.replace(/(?:[\W_]+)/g, "-")
.replace(/^(?:-+)|(?:-+)$/g, "");
};

/**
Expand Down

0 comments on commit 20248b8

Please sign in to comment.