Skip to content

Commit

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

0 comments on commit 5e6adf8

Please sign in to comment.