From ad2840a9885ed5f159fe5932cfd1309c35b1990f Mon Sep 17 00:00:00 2001 From: Sowmya Kota Date: Tue, 7 Nov 2023 11:43:51 -0800 Subject: [PATCH 1/2] fix: relative error related to console errors --- src/components/InternalLink/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/InternalLink/index.tsx b/src/components/InternalLink/index.tsx index ee2d097ef5f..7d51a4b11e8 100644 --- a/src/components/InternalLink/index.tsx +++ b/src/components/InternalLink/index.tsx @@ -28,7 +28,7 @@ export default function InternalLink({ href, children }) { const filterKey = filterKeys[filterKind]; if (href.includes('#')) { const hrefParts = href.split('#'); - href = `${hrefParts[0]}/q/${filterKind}/${filterKey}#${hrefParts[1]}`; + href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`; } else { href += `/q/${filterKind}/${filterKey}`; } From b2ac6041ec8f463b6350c3d1d8913ef981ccd629 Mon Sep 17 00:00:00 2001 From: Sowmya Kota Date: Thu, 9 Nov 2023 11:28:14 -0800 Subject: [PATCH 2/2] fix: links --- src/components/InternalLink/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/InternalLink/index.tsx b/src/components/InternalLink/index.tsx index 7d51a4b11e8..ddf087cffdb 100644 --- a/src/components/InternalLink/index.tsx +++ b/src/components/InternalLink/index.tsx @@ -28,9 +28,17 @@ export default function InternalLink({ href, children }) { const filterKey = filterKeys[filterKind]; if (href.includes('#')) { const hrefParts = href.split('#'); - href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`; + if (hrefParts[0].endsWith('/')) { + href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`; + } else { + href = `${hrefParts[0]}/q/${filterKind}/${filterKey}#${hrefParts[1]}`; + } } else { - href += `/q/${filterKind}/${filterKey}`; + if (href.endsWith('/')) { + href += `q/${filterKind}/${filterKey}`; + } else { + href += `/q/${filterKind}/${filterKey}`; + } } } }