diff --git a/src/components/Link/LinkBubbleView.vue b/src/components/Link/LinkBubbleView.vue index d1a1e46ca82..e0245c2a7d8 100644 --- a/src/components/Link/LinkBubbleView.vue +++ b/src/components/Link/LinkBubbleView.vue @@ -149,9 +149,8 @@ export default { * NcReferenceList only accepts full URLs with origin. */ sanitizedHref() { - return this.href?.startsWith('/') - ? location.origin + this.href - : this.href + const url = new URL(this.href, window.location) + return url.href }, title() { diff --git a/src/nodes/ParagraphView.vue b/src/nodes/ParagraphView.vue index d403632434f..b1b7db2fba4 100644 --- a/src/nodes/ParagraphView.vue +++ b/src/nodes/ParagraphView.vue @@ -106,9 +106,9 @@ export default { const linkMark = textNode?.marks.find((m) => m.type.name === 'link') const href = linkMark?.attrs?.href - const PATTERN = /(^)(https?:\/\/)((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)($)/ig - if ((new RegExp(PATTERN)).test(href)) { - return href + if (href) { + const url = new URL(href, window.location) + return url.href } return null