From dd82a706417b1ae622da86b29ff667455b68157b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 2 Jul 2024 14:43:33 +0200 Subject: [PATCH] correct encodeFilePath --- .../src/packages/core/utils/path/path-decode.function.ts | 3 ++- .../src/packages/core/utils/path/path-encode.function.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-decode.function.ts b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-decode.function.ts index 4858a64a5d..594d516f09 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-decode.function.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-decode.function.ts @@ -1 +1,2 @@ -export const decodeFilePath = (unique: string) => decodeURIComponent(unique.replace('-', '.')); +// Notice, no need to handle . or : specifically as decodeURIComponent does handle these. [NL] +export const decodeFilePath = (path: string) => decodeURIComponent(path); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-encode.function.ts b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-encode.function.ts index 7b7567cf74..9ccadd7409 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-encode.function.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/utils/path/path-encode.function.ts @@ -1,3 +1,3 @@ -export const encodeFilePath = (path: string) => encodeURIComponent(path).replaceAll('.', '-'); +export const encodeFilePath = (path: string) => encodeURIComponent(path).replaceAll('.', '%2E').replaceAll(':', '%3A'); export const aliasToPath = (path: string) => encodeFilePath(path);