From c7f6ea9955b8d519e0af420c4d96a66fbd106e3d Mon Sep 17 00:00:00 2001 From: Simao Rodrigues Date: Tue, 14 May 2024 15:35:50 +0100 Subject: [PATCH] Fix embed url generation for components embedded with the old contained url --- app/javascript/app/components/modal-share/modal-share.js | 3 ++- app/javascript/app/layouts/embed/embed-component.jsx | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/app/components/modal-share/modal-share.js b/app/javascript/app/components/modal-share/modal-share.js index 7967138a05..f8131e6a90 100644 --- a/app/javascript/app/components/modal-share/modal-share.js +++ b/app/javascript/app/components/modal-share/modal-share.js @@ -14,7 +14,8 @@ const mapStateToProps = (state, { shouldEmbedQueryParams = true }) => { const { isOpen: isModalOpen, sharePath } = state.modalShare; const { origin, pathname, search, hash } = location; const queryParams = shouldEmbedQueryParams ? search + hash : ''; - const embedUri = `/embed${sharePath || pathname.replace('/embed', '')}`; + const embedUri = `/embed${sharePath || + pathname.replace('/embed', '').replace('/contained', '')}`; const url = `${origin}${embedUri}${encodeURIComponent(queryParams)}`; const copyUrl = () => copy(url); const iframeCode = ``; diff --git a/app/javascript/app/layouts/embed/embed-component.jsx b/app/javascript/app/layouts/embed/embed-component.jsx index 52ae59ef8b..11383afdb6 100644 --- a/app/javascript/app/layouts/embed/embed-component.jsx +++ b/app/javascript/app/layouts/embed/embed-component.jsx @@ -13,7 +13,9 @@ import styles from './embed-styles.scss'; class Embed extends PureComponent { render() { const { route, location } = this.props; - const link = location.pathname.replace('/embed', ''); + const link = location.pathname + .replace('/embed', '') + .replace('/contained', ''); const isNdcp = isPageNdcp(location); return (