diff --git a/configs/main.js.example b/configs/main.js.example index 1b4ba425..f845e13b 100644 --- a/configs/main.js.example +++ b/configs/main.js.example @@ -138,6 +138,9 @@ module.exports = { true=allow only A-Za-z0-9_- regex=custom regex of what to replace e.g. /[^\w\s-]+/g */ filterFileNames: false, + /* replace spaces and multiple spaces with some character default _ for better filenames + (spaces dont belong in filenames) */ + spaceFileNameReplacement: '_', //options for code block highlighting in posts highlightOptions: { diff --git a/controllers/forms.js b/controllers/forms.js index 445addf7..75d9b54c 100644 --- a/controllers/forms.js +++ b/controllers/forms.js @@ -3,7 +3,7 @@ const express = require('express') , router = express.Router() , Boards = require(__dirname+'/../db/boards.js') - , { globalLimits, debugLogs, filterFileNames } = require(__dirname+'/../configs/main.js') + , { globalLimits, debugLogs, filterFileNames, spaceFileNameReplacement } = require(__dirname+'/../configs/main.js') //middlewares , calcPerms = require(__dirname+'/../helpers/checks/calcpermsmiddleware.js') , hasPerms = require(__dirname+'/../helpers/checks/haspermsmiddleware.js') @@ -29,6 +29,7 @@ const express = require('express') debug: debugLogs, createParentPath: true, safeFileNames: filterFileNames, + spaceFileNameReplacement, preserveExtension: 4, limits: { totalSize: globalLimits.postFilesSize.max, @@ -43,7 +44,8 @@ const express = require('express') debug: debugLogs, createParentPath: true, safeFileNames: filterFileNames, - preserveExtension: 3, + spaceFileNameReplacement, + preserveExtension: 4, limits: { totalSize: globalLimits.bannerFilesSize.max, fileSize: globalLimits.bannerFilesSize.max, diff --git a/package-lock.json b/package-lock.json index 38d82eca..e6d6555f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -226,7 +226,7 @@ } }, "@tohru/gm": { - "version": "github:fatchan/gm#c2ffb2ce0db3f64fbf4082462601429985b6dca6", + "version": "github:fatchan/gm#07df8fbf131b6b18c32fa010a84e67964e132955", "from": "github:fatchan/gm", "requires": { "array-parallel": "^0.1.3", @@ -2401,8 +2401,8 @@ } }, "express-fileupload": { - "version": "github:fatchan/express-fileupload#fd713ae7a3c7f381638d6479faa142d366304329", - "from": "github:fatchan/express-fileupload#fd713ae7a3c7f381638d6479faa142d366304329", + "version": "github:fatchan/express-fileupload#9aada2ecdef8a6617ccf82746e5faa2aece77239", + "from": "github:fatchan/express-fileupload", "requires": { "busboy": "^0.3.1" } @@ -3604,7 +3604,7 @@ } }, "gm": { - "version": "github:fatchan/gm#c2ffb2ce0db3f64fbf4082462601429985b6dca6", + "version": "github:fatchan/gm#07df8fbf131b6b18c32fa010a84e67964e132955", "from": "github:fatchan/gm", "requires": { "array-parallel": "^0.1.3",