feat: resolved trailing slash in secret paths

This commit is contained in:
Akhil Mohan
2024-01-29 00:21:42 +05:30
parent f010a3a932
commit 4e20735f98
10 changed files with 75 additions and 44 deletions
+6
View File
@@ -3,3 +3,9 @@ import path from "path";
// given two paths irrespective of ending with / or not
// this will return true if its equal
export const isSamePath = async (from: string, to: string) => !path.relative(from, to);
export const removeTrailingSlash = (str: string) => {
if (str === "/") return str;
return str.endsWith("/") ? str.slice(0, -1) : str;
};