user15004012
user15004012

Reputation: 13

PLP Router Link encodes Product Code with slash / to %2F, Getting 404 on PDP

If we have product codes with "/", it gets encoded to "%2F".

Example Encoded URL: domain.com/baseSite/p/AB%2FC When this encoded URL is directly accessed or bookmarked, we are getting HTTP 404. Seems like the Spartacus was not able to map the route. Please advise.

Product Code (width slash): AB/C

Template html:

      <a [routerLink]="{ cxRoute: 'product', params: product } | cxUrl">

Generated HTML

<a ng-reflect-router-link="/,p,AB/C" href="/<baseSiteId>/p/AB%2FC">

Upvotes: 0

Views: 441

Answers (1)

Caine Rotherham
Caine Rotherham

Reputation: 306

This is an Angular issue as opposed to Spartacus. Params should be passed to [routerLink] as an array rather than a literal string.

For example:

<a [routerLink]="{ cxRoute: 'product', params: ['my', 'slashy', 'product'] } | cxUrl">

This is how angular handles params using router link: https://angular.io/api/router/RouterLink

Upvotes: 0

Related Questions