Skip to content

Commit 2ce7721

Browse files
Enforce trailing slash
1 parent 8f4ce64 commit 2ce7721

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,14 @@ export const InteractiveBlockComponent = ({
385385
if (graphicUrl.search.length) {
386386
graphicUrl.search += '&dark=false';
387387
} else {
388+
// Embed URLs without a trailing slash are redirected and the
389+
// search param is lost so we need to add it to the pathname
390+
const hasTrailingSlash = graphicUrl.pathname.endsWith(
391+
'/',
392+
)
393+
? true
394+
: false;
395+
graphicUrl.pathname += hasTrailingSlash ? '' : '/';
388396
graphicUrl.search += '?dark=false';
389397
}
390398
}

0 commit comments

Comments
 (0)