Skip to content

Commit

Permalink
Patch Unknown URL Record
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Feb 23, 2024
1 parent b89a62b commit 9943b5b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/Records/records.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ const buttonControls = (key: string, value: string): ReactNode | undefined => {
}

if (key == 'url') {
const { hostname } = new URL(formatted || value);
let label = value;

try {
const { hostname } = new URL(formatted || value);

label = hostname;
} catch (error) {
console.error('Error parsing URL', error);
}

return (
<AButton href={value} className="btn-url">
<FiLink />
{hostname}
{label}
</AButton>
);
}
Expand Down

0 comments on commit 9943b5b

Please sign in to comment.