fix: update formatWithSlashes function to return "//" for invalid input

This commit is contained in:
medchedli 2025-06-04 18:02:03 +01:00
parent 520c60a8e7
commit d6d0664580

View File

@ -30,7 +30,7 @@ export const isRegexString = (str: any) => {
* Ensures value is wrapped in slashes: /value/ * Ensures value is wrapped in slashes: /value/
*/ */
export const formatWithSlashes = (value: string): string => { export const formatWithSlashes = (value: string): string => {
if (!value || typeof value !== "string") return "/"; if (!value || typeof value !== "string") return "//";
if (!value.startsWith("/")) value = "/" + value; if (!value.startsWith("/")) value = "/" + value;
if (!value.endsWith("/")) value = value + "/"; if (!value.endsWith("/")) value = value + "/";