option to replace spaces in filename:

merge-requests/208/head
fatchan 4 years ago
parent 06703c4743
commit 569398a2e4
  1. 3
      configs/main.js.example
  2. 6
      controllers/forms.js
  3. 8
      package-lock.json

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

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

8
package-lock.json generated

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

Loading…
Cancel
Save