chore: remove / from old version url (#43117)

This commit is contained in:
afc163 2023-06-20 19:38:42 +08:00 committed by GitHub
parent 5d65881984
commit 9c4b20d5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,11 +213,13 @@ const Header: React.FC = () => {
.replace(/\/$/, '');
return;
}
// Mirror url must have `/`, we add this for compatible
const urlObj = new URL(currentUrl.replace(window.location.origin, url));
urlObj.pathname = `${urlObj.pathname.replace(/\/$/, '')}/`;
window.location.href = urlObj.href;
if (urlObj.host === '3x.ant.design' || urlObj.host === '4x.ant.design') {
window.location.href = urlObj.href.replace(/\/$/, '');
return;
}
window.location.href = `${urlObj.href.replace(/\/$/, '')}/`;
}, []);
const onLangChange = useCallback(() => {