diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-11-12 11:17:29 +0300 |
---|---|---|
committer | npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com> | 2020-11-12 17:43:19 +0300 |
commit | c444119e6ca5634976a0d553cd73fd26c661eff6 (patch) | |
tree | 2b96b29bba897766c73e3168b6b142abad734396 /src | |
parent | a42caa79518e2b43ea514c27c9521df3e8ecbaf9 (diff) |
Validate link before opening
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/marks/index.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/marks/index.js b/src/marks/index.js index 0a719aaca..1b71307d9 100644 --- a/src/marks/index.js +++ b/src/marks/index.js @@ -24,6 +24,7 @@ import { Bold, Italic as TipTapItalic, Strike as TipTapStrike, Link as TipTapLin import { Plugin } from 'tiptap' import { getMarkAttrs } from 'tiptap-utils' import { domHref, parseHref } from './../helpers/links' +import { markdownit } from './../EditorFactory' /** * This file maps prosemirror mark names to tiptap classes, @@ -132,12 +133,16 @@ class Link extends TipTapLink { // OC.Util.History.pushState('', htmlHref) } OCA.Viewer.open({ path }) - } else { - window.open(htmlHref) + return } - } else { - window.open(htmlHref) } + + if (!markdownit.validateLink(htmlHref)) { + console.error('Invalid link', htmlHref) + return + } + + window.open(htmlHref) } }, }, |