Skip to content

Commit

Permalink
fix(extension-link): extract the scheme from the URL before checking …
Browse files Browse the repository at this point in the history
…whether it's javascript
  • Loading branch information
MUDRY Julien committed May 16, 2024
1 parent b79de07 commit f95429c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/extension-link/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const Link = Mark.create<LinkOptions>({
renderHTML({ HTMLAttributes }) {
// False positive; we're explicitly checking for javascript: links to ignore them
// eslint-disable-next-line no-script-url
if (HTMLAttributes.href?.toLowerCase().trim().startsWith('javascript:')) {
if (HTMLAttributes.href?.substring(0, HTMLAttributes.href.indexOf(':')).toLowerCase().trim() === 'javascript') {
// strip out the href
return ['a', mergeAttributes(this.options.HTMLAttributes, { ...HTMLAttributes, href: '' }), 0]
}
Expand Down

0 comments on commit f95429c

Please sign in to comment.