Skip to content

Commit

Permalink
fix: encode product urls (#1688)
Browse files Browse the repository at this point in the history
* Revert "fix: remove '%' signs from product slugs (#1687)"
This reverts commit 6903fd2.
* fix: encode product url, if programmatically changed
* e.g. after variation selection on PDP
  • Loading branch information
SGrueber authored Jun 21, 2024
1 parent 101f619 commit d2e6c82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/core/facades/selected-product-context.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
);
}
}
2 changes: 1 addition & 1 deletion src/app/core/utils/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d2e6c82

Please sign in to comment.