Skip to content

Commit e5e79d9

Browse files
Merge pull request #54 from topcoder-platform/TCA-373_handle-videos
TCA-373 Support FCC Video Links -> dev
2 parents 6e4c4d5 + e5798c6 commit e5e79d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

client/src/components/layouts/tc-integration.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ class TcIntegrationLayout extends Component<TcIntegrationLayoutProps> {
146146
// set the pathname for the 2 flavors of lesson URL
147147
const platformPathPrefix = 'learn/freecodecamp';
148148
const learnPrefix = '/learn/';
149+
let updateHost = false;
149150
if (url.host === `learn.${fccHost}`) {
150151
url.pathname = `${platformPathPrefix}${url.pathname}`;
152+
updateHost = true;
151153
} else if (
152154
url.host === `www.${fccHost}` &&
153155
url.pathname.startsWith(learnPrefix)
@@ -156,10 +158,13 @@ class TcIntegrationLayout extends Component<TcIntegrationLayoutProps> {
156158
learnPrefix,
157159
`/${platformPathPrefix}/`
158160
);
161+
updateHost = true;
159162
}
160163

161164
// set the host to the iframe's parent domain
162-
url.host = new URL(document.referrer).host;
165+
if (updateHost) {
166+
url.host = new URL(document.referrer).host;
167+
}
163168
}
164169

165170
// now open the url in a new tab

0 commit comments

Comments
 (0)