From 353c57a5688bf7068b16883398a83377f54e1bde Mon Sep 17 00:00:00 2001 From: btzr-io Date: Mon, 24 Aug 2020 15:45:08 -0500 Subject: [PATCH] fix #4686 --- ui/component/publishFile/view.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx index cf5d1542b..5a4b0a67d 100644 --- a/ui/component/publishFile/view.jsx +++ b/ui/component/publishFile/view.jsx @@ -257,16 +257,16 @@ function PublishFile(props: Props) { const isVideo = contentType && contentType[0] === 'video'; const isMp4 = contentType && contentType[1] === 'mp4'; - let isMarkdownText = false; + let isTextPost = false; - if (contentType) { - isMarkdownText = contentType[0] === 'text'; + if (contentType && contentType[0] === 'text') { + isTextPost = contentType[1] === 'plain' || contentType[1] === 'markdown'; setCurrentFileType(contentType); } else if (file.name) { // If user's machine is missign a valid content type registration // for markdown content: text/markdown, file extension will be used instead const extension = file.name.split('.').pop(); - isMarkdownText = MARKDOWN_FILE_EXTENSIONS.includes(extension); + isTextPost = MARKDOWN_FILE_EXTENSIONS.includes(extension); } if (isVideo) { @@ -288,7 +288,7 @@ function PublishFile(props: Props) { updateFileInfo(0, file.size, isVideo); } - if (isMarkdownText) { + if (isTextPost) { // Create reader const reader = new FileReader(); // Handler for file reader