Skip to content

Commit 578141f

Browse files
authored
Merge pull request #7069 from topcoder-platform/pm-714
fix(PM-714): encode uri return url to fix xss dom error
2 parents 5c9ca46 + 6e7d2a0 commit 578141f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/shared/containers/tc-communities/tco20/Header.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ function TCO20Header(props) {
2525
</React.Fragment>
2626
) : (
2727
<React.Fragment>
28-
<a href={`${config.URL.AUTH}/member?utm_source=TCO20site&retUrl=${getCurrentUrl()}`} className={defaultStyle.loginLink}>LOGIN</a>
29-
<a href={`${config.URL.AUTH}/member/registration?utm_source=TCO20site&retUrl=${getCurrentUrl()}`} className={defaultStyle.signUpLink}>SIGN UP</a>
28+
<a href={`${config.URL.AUTH}/member?utm_source=TCO20site&retUrl=${encodeURIComponent(getCurrentUrl())}`} className={defaultStyle.loginLink}>LOGIN</a>
29+
<a href={`${config.URL.AUTH}/member/registration?utm_source=TCO20site&retUrl=${encodeURIComponent(getCurrentUrl())}`} className={defaultStyle.signUpLink}>SIGN UP</a>
3030
</React.Fragment>
3131
)
3232
}

src/shared/utils/url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { BUCKETS } from 'utils/challenge-listing/buckets';
1414
*/
1515
export function getCurrentUrl() {
1616
if (isomorphy.isServerSide()) return null;
17-
const url = window.location.href;
17+
const url = window.location.origin + window.location.pathname;
1818

1919
if (typeof url === 'string' && url.startsWith('http')) {
2020
return url;

0 commit comments

Comments
 (0)