Skip to content

Commit

Permalink
old changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-raj committed Feb 5, 2025
1 parent e28211e commit 58ebf83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const sanitizePath = (str: string) => {
return str
?.replace(/^([\/\\])+/, "") // Normalize leading slashes/backslashes to ''
?.replace(/^([\/\\])+/, "./") // Normalize leading slashes/backslashes to ''
.replace(/[\/\\]+/g, "/") // Replace multiple slashes/backslashes with a single '/'
.replace(/(\.\.(\/|\\|$))+/g, ""); // Remove directory traversal (../ or ..\)
}
Expand Down

0 comments on commit 58ebf83

Please sign in to comment.