diff --git a/packages/shared/src/utils/parseURL.ts b/packages/shared/src/utils/parseURL.ts index 982e6ee9a42f..edc16151eb52 100644 --- a/packages/shared/src/utils/parseURL.ts +++ b/packages/shared/src/utils/parseURL.ts @@ -1,4 +1,14 @@ import parser from 'anchorme' export function parseURL(string: string) { - return parser.list(string).map((x) => x.string) + return parser + .list(string) + .map((x) => x.string) + .filter((y) => { + try { + new URL(y) + return true + } catch { + return false + } + }) }