Trim whitespace in sanitizePath function (#215)

Add whitespace trimming to sanitizePath function.
This commit is contained in:
SjxSubham
2026-01-08 11:04:08 +05:30
committed by GitHub
parent 14297171be
commit ae8b610462
+2 -1
View File
@@ -9,6 +9,7 @@ export function cn(...inputs: ClassValue[]) {
export function sanitizePath(input: string, os: string): string { export function sanitizePath(input: string, os: string): string {
let sanitized = input.trim(); // it will trim whitespace
if (os === "Windows") { if (os === "Windows") {
return input.replace(/[<>:"/\\|?*]/g, "_"); return input.replace(/[<>:"/\\|?*]/g, "_");
} }
@@ -56,4 +57,4 @@ export function openExternal(url: string) {
window.open(url, "_blank", "noopener,noreferrer"); window.open(url, "_blank", "noopener,noreferrer");
} }
} }
} }