Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-11-12 11:17:29 +0300
committernpmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>2020-11-12 17:43:19 +0300
commitc444119e6ca5634976a0d553cd73fd26c661eff6 (patch)
tree2b96b29bba897766c73e3168b6b142abad734396 /src
parenta42caa79518e2b43ea514c27c9521df3e8ecbaf9 (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.js13
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)
}
},
},