From: Chocobozzz Date: Tue, 23 Jan 2018 15:32:49 +0000 (+0100) Subject: Avoid to linkify truncated links X-Git-Tag: v0.0.14-alpha~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=63c4b44961aa86ed4dabf039e495879103f9d729;p=oweals%2Fpeertube.git Avoid to linkify truncated links --- diff --git a/client/src/app/videos/shared/markdown.service.ts b/client/src/app/videos/shared/markdown.service.ts index d8b5b76b6..82745f0c6 100644 --- a/client/src/app/videos/shared/markdown.service.ts +++ b/client/src/app/videos/shared/markdown.service.ts @@ -35,6 +35,9 @@ export class MarkdownService { } markdownToHTML (markdown: string) { - return this.markdownIt.render(markdown) + const html = this.markdownIt.render(markdown) + + // Avoid linkify truncated links + return html.replace(/]+>([^<]+)<\/a>\s*...(<\/p>)?$/mi, '$1...') } }