Fix error with trailing slash in listing page URL

This commit is contained in:
Kimmo Puputti 2018-03-09 13:31:49 +02:00
parent 1650a87370
commit 84850528cc

View file

@ -108,7 +108,9 @@ export const canonicalRoutePath = (routes, location) => {
if (isListingRoute) {
// Remove the dynamic slug from the listing page canonical URL
const parts = pathname.split('/');
// Remove possible trailing slash
const cleanedPathName = pathname.replace(/\/$/, '');
const parts = cleanedPathName.split('/');
if (parts.length !== 4) {
throw new Error('Expected ListingPage route to have 4 parts');