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 dde057b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/slugify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*/
export const slugify = (str: string): string => {
return str
.trim()
.toLowerCase()
.replace(/&/g, "and")
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+/g, "")
.replace(/-+$/g, "");
.replace(/[\W_]+/g, "-")
.replace(/^(-+)|(-+)$/g, "");
};

/**
Expand Down

0 comments on commit dde057b

Please sign in to comment.