fix for file with no name, only extension having missing extension after uploading

merge-requests/208/head
fatchan 5 years ago
parent a1292bd48a
commit 0a0d5512be
  1. 2
      helpers/posting/markdown.js
  2. 2
      helpers/posting/quotes.js
  3. 2
      models/forms/makepost.js

@ -27,7 +27,7 @@ module.exports = (text) => {
//links
text = text.replace(linkRegex, (match) => {
return `<a referrerpolicy='strict-origin' href='${match}'>${match}</a>`;
return `<a referrerpolicy='strict-origin' target='_blank' href='${match}'>${match}</a>`;
});
//bold

@ -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 `<a class='quote' href='/${quoteboard}/thread/${postThreadIdMap[quoteboard][quotenum].thread}.html#${quotenum}'>&gt;&gt;&gt;/${quoteboard}/${quotenum}</a>`;
} else {
return `<a class='quote' href='/${quoteboard}/index.html'>&gt;&gt;&gt;/${quoteboard}/</a>`;

@ -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

Loading…
Cancel
Save