diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-16 07:41:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-16 07:41:35 +0200 |
commit | 46460547caf558d50040acc75b25373ea07fc83c (patch) | |
tree | 355d872757cf2b744f4291a1c9a715467a83ac3a /server | |
parent | 205e4f56f3da1f787f1bc2cdfcc39948a99a16b1 (diff) | |
download | PeerTube-46460547caf558d50040acc75b25373ea07fc83c.tar.gz PeerTube-46460547caf558d50040acc75b25373ea07fc83c.tar.zst PeerTube-46460547caf558d50040acc75b25373ea07fc83c.zip |
Fix exception in markdown parser
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/markdown.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/helpers/markdown.ts b/server/helpers/markdown.ts index 7c4a1a8b1..2126bb752 100644 --- a/server/helpers/markdown.ts +++ b/server/helpers/markdown.ts | |||
@@ -9,6 +9,8 @@ markdownIt.enable(TEXT_WITH_HTML_RULES) | |||
9 | markdownIt.use(markdownItEmoji) | 9 | markdownIt.use(markdownItEmoji) |
10 | 10 | ||
11 | const toSafeHtml = text => { | 11 | const toSafeHtml = text => { |
12 | if (!text) return '' | ||
13 | |||
12 | // Restore line feed | 14 | // Restore line feed |
13 | const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n') | 15 | const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n') |
14 | 16 | ||
@@ -20,6 +22,8 @@ const toSafeHtml = text => { | |||
20 | } | 22 | } |
21 | 23 | ||
22 | const mdToPlainText = text => { | 24 | const mdToPlainText = text => { |
25 | if (!text) return '' | ||
26 | |||
23 | // Convert possible markdown (emojis, emphasis and lists) to html | 27 | // Convert possible markdown (emojis, emphasis and lists) to html |
24 | const html = markdownIt.render(text) | 28 | const html = markdownIt.render(text) |
25 | 29 | ||