Skip to content

Commit

Permalink
Merge pull request #6228 from aws-amplify/Internal-links
Browse files Browse the repository at this point in the history
fix: relative url error related to console errors
  • Loading branch information
sowmyadev-kota authored Nov 10, 2023
2 parents ebacdcc + ce6c1a6 commit 5b5e82b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/InternalLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}
}
}
}
Expand Down

0 comments on commit 5b5e82b

Please sign in to comment.