From 0a0d5512be73a80878b8872b7d74c21dd8e292cc Mon Sep 17 00:00:00 2001 From: fatchan Date: Sun, 21 Jul 2019 04:11:54 +0000 Subject: [PATCH] fix for file with no name, only extension having missing extension after uploading --- helpers/posting/markdown.js | 2 +- helpers/posting/quotes.js | 2 +- models/forms/makepost.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/posting/markdown.js b/helpers/posting/markdown.js index b9179e54..1a52cbf2 100644 --- a/helpers/posting/markdown.js +++ b/helpers/posting/markdown.js @@ -27,7 +27,7 @@ module.exports = (text) => { //links text = text.replace(linkRegex, (match) => { - return `${match}`; + return `${match}`; }); //bold diff --git a/helpers/posting/quotes.js b/helpers/posting/quotes.js index 93dcaf74..b2b7b6e5 100644 --- a/helpers/posting/quotes.js +++ b/helpers/posting/quotes.js @@ -108,7 +108,7 @@ module.exports = async (board, text, thread) => { const quoteboard = quote[1]; const quotenum = +quote[2]; if (postThreadIdMap[quoteboard]) { - if (!isNaN(quotenum) && quoteNnum > 0 && postThreadIdMap[quoteboard][quotenum]) { + if (!isNaN(quotenum) && quotenum > 0 && postThreadIdMap[quoteboard][quotenum]) { return `>>>/${quoteboard}/${quotenum}`; } else { return `>>>/${quoteboard}/`; diff --git a/models/forms/makepost.js b/models/forms/makepost.js index 977c1c94..ac2a0d0d 100644 --- a/models/forms/makepost.js +++ b/models/forms/makepost.js @@ -95,7 +95,7 @@ module.exports = async (req, res, next) => { // then upload, thumb, get metadata, etc. for (let i = 0; i < res.locals.numFiles; i++) { const file = req.files.file[i]; - const extension = path.extname(file.name); + let extension = path.extname(file.name) || file.name.substring(file.name.indexOf('.')); const filename = file.sha256 + extension; //get metadata