mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 10:45:20 -04:00
fix: Use more strict vimeo id regex
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
9996df1abd
commit
8245a519e0
2 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ import { VimeoMarkdownExtension } from './vimeo-markdown-extension'
|
||||||
import type MarkdownIt from 'markdown-it'
|
import type MarkdownIt from 'markdown-it'
|
||||||
import markdownItRegex from 'markdown-it-regex'
|
import markdownItRegex from 'markdown-it-regex'
|
||||||
|
|
||||||
export const legacyVimeoRegex = /^{%vimeo ([\d]{6,11}) ?%}$/
|
export const legacyVimeoRegex = /^{%vimeo\s+(\d{6,11})\s*%}$/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the given {@link MarkdownIt} to render legacy hedgedoc 1 vimeo short codes as embeddings.
|
* Configure the given {@link MarkdownIt} to render legacy hedgedoc 1 vimeo short codes as embeddings.
|
||||||
|
|
|
@ -11,7 +11,7 @@ import markdownItRegex from 'markdown-it-regex'
|
||||||
|
|
||||||
const protocolRegex = /(?:http(?:s)?:\/\/)?/
|
const protocolRegex = /(?:http(?:s)?:\/\/)?/
|
||||||
const domainRegex = /(?:player\.)?(?:vimeo\.com\/)(?:(?:channels|album|ondemand|groups)\/\w+\/)?(?:video\/)?/
|
const domainRegex = /(?:player\.)?(?:vimeo\.com\/)(?:(?:channels|album|ondemand|groups)\/\w+\/)?(?:video\/)?/
|
||||||
const idRegex = /([\d]{6,11})/
|
const idRegex = /(\d{6,11})/
|
||||||
const tailRegex = /(?:[?#].*)?/
|
const tailRegex = /(?:[?#].*)?/
|
||||||
const vimeoVideoUrlRegex = new RegExp(
|
const vimeoVideoUrlRegex = new RegExp(
|
||||||
`(?:${protocolRegex.source}${domainRegex.source}${idRegex.source}${tailRegex.source})`
|
`(?:${protocolRegex.source}${domainRegex.source}${idRegex.source}${tailRegex.source})`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue