From 9c4b20d5eb5f21b421fbcd1b66c831f522df1d7a Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 20 Jun 2023 19:38:42 +0800 Subject: [PATCH] chore: remove / from old version url (#43117) --- .dumi/theme/slots/Header/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.dumi/theme/slots/Header/index.tsx b/.dumi/theme/slots/Header/index.tsx index 307f7d9754..b6938ed189 100644 --- a/.dumi/theme/slots/Header/index.tsx +++ b/.dumi/theme/slots/Header/index.tsx @@ -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(() => {