From d2e6c825437bcb34a311c31fab57dce89c24219c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silke=20Gr=C3=BCber?= Date: Fri, 21 Jun 2024 14:11:58 +0200 Subject: [PATCH] fix: encode product urls (#1688) * Revert "fix: remove '%' signs from product slugs (#1687)" This reverts commit 6903fd2176448607d0e65b9474f90f8d27eefa58. * fix: encode product url, if programmatically changed * e.g. after variation selection on PDP --- src/app/core/facades/selected-product-context.facade.ts | 2 +- src/app/core/utils/routing.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/facades/selected-product-context.facade.ts b/src/app/core/facades/selected-product-context.facade.ts index 0bea0d5dcc..6cfe27df67 100644 --- a/src/app/core/facades/selected-product-context.facade.ts +++ b/src/app/core/facades/selected-product-context.facade.ts @@ -42,7 +42,7 @@ export class SelectedProductContextFacade extends ProductContextFacade { withLatestFrom(appFacade.routingInProgress$), filter(([, progress]) => !progress) ), - ([url]) => router.navigateByUrl(url) + ([url]) => router.navigateByUrl(encodeURI(url), { replaceUrl: true }) ); } } diff --git a/src/app/core/utils/routing.ts b/src/app/core/utils/routing.ts index b794665b73..8a914efe30 100644 --- a/src/app/core/utils/routing.ts +++ b/src/app/core/utils/routing.ts @@ -34,7 +34,7 @@ export function addGlobalGuard( * RegEx that finds reserved characters that should not be contained in non functional parts of routes/URLs (e.g product slugs for SEO) */ // not-dead-code -export const reservedCharactersRegEx = /[ &\(\)=%]/g; +export const reservedCharactersRegEx = /[ &\(\)=]/g; /** * Sanitize slug data (remove reserved characters, clean up obsolete '-', lower case, capitalize identifiers)