Fix mac instead of total for asset/banner/flag count checking in controllers

indiachan-spamvector
Thomas Lynch 1 year ago
parent f050160682
commit 8f9ecb9de2
  1. 2
      controllers/forms/addassets.js
  2. 2
      controllers/forms/addflags.js
  3. 2
      controllers/forms/uploadbanners.js

@ -17,7 +17,7 @@ module.exports = {
const errors = await checkSchema([
{ result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' },
{ result: numberBody(res.locals.numFiles, 0, globalLimits.assetFiles.max), expected: true, error: `Exceeded max asset uploads in one request of ${globalLimits.assetFiles.max}` },
{ result: numberBody(res.locals.board.assets.length+res.locals.numFiles, 0, globalLimits.assetFiles.max), expected: true, error: `Total number of assets would exceed global limit of ${globalLimits.assetFiles.total}` },
{ result: numberBody(res.locals.board.assets.length+res.locals.numFiles, 0, globalLimits.assetFiles.total), expected: true, error: `Total number of assets would exceed global limit of ${globalLimits.assetFiles.total}` },
]);
if (errors.length > 0) {

@ -17,7 +17,7 @@ module.exports = {
const errors = await checkSchema([
{ result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' },
{ result: numberBody(res.locals.numFiles, 0, globalLimits.flagFiles.max), expected: true, error: `Exceeded max flag uploads in one request of ${globalLimits.flagFiles.max}` },
{ result: numberBody(Object.keys(res.locals.board.flags).length+res.locals.numFiles, 0, globalLimits.flagFiles.max), expected: true, error: `Total number of flags would exceed global limit of ${globalLimits.flagFiles.total}` },
{ result: numberBody(Object.keys(res.locals.board.flags).length+res.locals.numFiles, 0, globalLimits.flagFiles.total), expected: true, error: `Total number of flags would exceed global limit of ${globalLimits.flagFiles.total}` },
]);
if (errors.length > 0) {

@ -17,7 +17,7 @@ module.exports = {
const errors = await checkSchema([
{ result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' },
{ result: numberBody(res.locals.numFiles, 0, globalLimits.bannerFiles.max), expected: true, error: `Exceeded max banner uploads in one request of ${globalLimits.bannerFiles.max}` },
{ result: numberBody(res.locals.board.banners.length+res.locals.numFiles, 0, globalLimits.bannerFiles.max), expected: true, error: `Total number of banners would exceed global limit of ${globalLimits.bannerFiles.total}` },
{ result: numberBody(res.locals.board.banners.length+res.locals.numFiles, 0, globalLimits.bannerFiles.total), expected: true, error: `Total number of banners would exceed global limit of ${globalLimits.bannerFiles.total}` },
]);
if (errors.length > 0) {

Loading…
Cancel
Save