From 7dac0cf3f3f4ab67377a123d480a2f6d4eb54e0d Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 29 Sep 2021 18:32:12 +0200 Subject: [PATCH] Removed color max length, using regex instead --- app/imports/api/properties/Actions.js | 2 +- app/imports/api/properties/subSchemas/ItemConsumedSchema.js | 2 +- app/imports/constants/STORAGE_LIMITS.js | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/imports/api/properties/Actions.js b/app/imports/api/properties/Actions.js index 8f8007d3..caa3c51e 100644 --- a/app/imports/api/properties/Actions.js +++ b/app/imports/api/properties/Actions.js @@ -175,7 +175,7 @@ const ComputedOnlyActionSchema = createPropertySchema({ 'resources.itemsConsumed.$.itemColor': { type: String, optional: true, - max: STORAGE_LIMITS.color, + regEx: /^#([a-f0-9]{3}){1,2}\b$/i, removeBeforeCompute: true, }, 'resources.attributesConsumed': { diff --git a/app/imports/api/properties/subSchemas/ItemConsumedSchema.js b/app/imports/api/properties/subSchemas/ItemConsumedSchema.js index 1bf08904..2290649d 100644 --- a/app/imports/api/properties/subSchemas/ItemConsumedSchema.js +++ b/app/imports/api/properties/subSchemas/ItemConsumedSchema.js @@ -49,7 +49,7 @@ const ComputedOnlyItemConsumedSchema = new SimpleSchema({ itemColor: { type: String, optional: true, - max: STORAGE_LIMITS.color, + regEx: /^#([a-f0-9]{3}){1,2}\b$/i, }, }); diff --git a/app/imports/constants/STORAGE_LIMITS.js b/app/imports/constants/STORAGE_LIMITS.js index 11cc55d0..f2bd1e1f 100644 --- a/app/imports/constants/STORAGE_LIMITS.js +++ b/app/imports/constants/STORAGE_LIMITS.js @@ -2,7 +2,6 @@ const STORAGE_LIMITS = Object.freeze({ // String lengths calculation: 1024, collectionName: 64, - color: 10000, description: 49473, //the length of the Bee Movie script inlineCalculationField: 49473, errorMessage: 256,