Skip to content

Commit

Permalink
test regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Nov 6, 2024
1 parent 837dac0 commit 021a4ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/src/containers/countries/countries-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,14 @@ const CountriesTable = () => {
v.resources?.length ? (
v.resources?.map((r) => {
if (!/^https?:\/\/|^www\./i.test(r.link_url)) {
console.info("Invalid URL", r.link_url);
r.link_url = `https://${r.link_url}`;
}
const URL = !/^https?:\/\/|^www\./i.test(r.link_url)
? `https://${r.link_url}`
: r.link_url;

console.info("URL", URL, r.link_url);
return (
<Popover key={r.link_title}>
<PopoverTrigger className="whitespace-nowrap rounded border border-brand1/20 bg-brand1/10 px-2.5 py-[3px] text-xs leading-none text-brand1 data-[state='open']:bg-brand1 data-[state='open']:text-white">
Expand Down

0 comments on commit 021a4ef

Please sign in to comment.