diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-11-12 11:17:29 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-11-12 11:18:02 +0300 |
commit | e8f73e7dedeac415aeb5e2fbc866a4abecaa8977 (patch) | |
tree | c65c0b6a97216b4b97e36c65e52d9e27cedc690f /src/marks/index.js | |
parent | e520937bbaccead7226ba97e66acf10af5a93487 (diff) |
Validate link before opening
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/marks/index.js')
-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) } }, }, |