From 666fd36845fdf77e648c76fcf375c347117d0376 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 9 Jul 2021 06:27:05 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20Portal=20links=20not=20w?= =?UTF-8?q?orking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Portal/commit/25389193f6359fa5fb968079a5bcd0f536e2a750 Fixes Portal link identification logic which was broken with updated regex for handling of new product specific plans --- ghost/portal/src/App.js | 2 +- ghost/portal/src/utils/helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/App.js b/ghost/portal/src/App.js index 01cfc32895..6b08c8648d 100644 --- a/ghost/portal/src/App.js +++ b/ghost/portal/src/App.js @@ -336,7 +336,7 @@ export default class App extends React.Component { const productMonthlyPriceQueryRegex = /^(?:(\w+?))?\/monthly$/; const productYearlyPriceQueryRegex = /^(?:(\w+?))?\/monthly$/; const [path] = window.location.hash.substr(1).split('?'); - const linkRegex = /^\/portal\/?(?:\/(\w+(?:\/\w+)+))?\/?$/; + const linkRegex = /^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/; if (path && linkRegex.test(path)) { const [,pagePath] = path.match(linkRegex); const {page, pageQuery} = this.getPageFromLinkPath(pagePath) || {}; diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index 9bf96c4b26..16b4fea888 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -2,7 +2,7 @@ import calculateDiscount from './discount'; export function removePortalLinkFromUrl() { const [path] = window.location.hash.substr(1).split('?'); - const linkRegex = /^\/portal\/?(?:\/(\w+(?:\/\w+)+))?\/?$/; + const linkRegex = /^\/portal\/?(?:\/(\w+(?:\/\w+)*))?\/?$/; if (path && linkRegex.test(path)) { window.history.pushState('', document.title, window.location.pathname + window.location.search); }