From 88188a0a591a6bc00543fddd2665b6c0168a9c33 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 3 Nov 2022 07:38:19 -0400 Subject: [PATCH] fix: Sanitize url before opening --- shared/editor/marks/Link.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/editor/marks/Link.tsx b/shared/editor/marks/Link.tsx index fc1971906..11f4817cb 100644 --- a/shared/editor/marks/Link.tsx +++ b/shared/editor/marks/Link.tsx @@ -132,7 +132,10 @@ export default class Link extends Mark { if (range && range.mark && this.options.onClickLink) { try { const event = new KeyboardEvent("keydown", { metaKey: false }); - this.options.onClickLink(range.mark.attrs.href, event); + this.options.onClickLink( + sanitizeUrl(range.mark.attrs.href), + event + ); } catch (err) { this.editor.props.onShowToast( this.options.dictionary.openLinkError @@ -242,7 +245,7 @@ export default class Link extends Mark { if (this.options.onClickLink) { event.stopPropagation(); event.preventDefault(); - this.options.onClickLink(href, event); + this.options.onClickLink(sanitizeUrl(href), event); } } catch (err) { this.editor.props.onShowToast(