xzwebx-httpfilter 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HttpFilter.js +62 -7
- package/package.json +1 -1
package/HttpFilter.js
CHANGED
|
@@ -198,23 +198,55 @@ function IsStringOk(fCfgItem, paramValue) {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
if (!isPass) {
|
|
201
|
+
if (rule.ruleDesc) {
|
|
202
|
+
return rule.ruleDesc
|
|
203
|
+
}
|
|
201
204
|
return ['WRONG_STR_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
|
|
202
205
|
}
|
|
203
206
|
} else if (rule.checkType == 'ENU') {
|
|
204
207
|
if (rule.isCaseSensitive == 1) {
|
|
205
|
-
if (rule.exprVal && rule.exprVal.length
|
|
206
|
-
|
|
208
|
+
if (rule.exprVal && rule.exprVal.length) {
|
|
209
|
+
if (rule.isMatched === 1) {
|
|
210
|
+
if (!rule.exprVal.includes(paramValue)) {
|
|
211
|
+
if (rule.ruleDesc) {
|
|
212
|
+
return rule.ruleDesc
|
|
213
|
+
}
|
|
214
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
if (rule.exprVal.includes(paramValue)) {
|
|
218
|
+
if (rule.ruleDesc) {
|
|
219
|
+
return rule.ruleDesc
|
|
220
|
+
}
|
|
221
|
+
return ['EXCLUSION_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
222
|
+
}
|
|
223
|
+
}
|
|
207
224
|
}
|
|
208
225
|
} else {
|
|
209
226
|
let isPass = false
|
|
210
227
|
for (let k in rule.exprVal) {
|
|
211
|
-
if (rule.
|
|
228
|
+
if (rule.isMatched === 1) {
|
|
229
|
+
if (rule.exprVal[k].toUpperCase() === paramValue.toUpperCase()) {
|
|
230
|
+
isPass = true
|
|
231
|
+
break
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
212
234
|
isPass = true
|
|
213
|
-
|
|
235
|
+
if (rule.exprVal[k].toUpperCase() == paramValue.toUpperCase()) {
|
|
236
|
+
isPass = false
|
|
237
|
+
break
|
|
238
|
+
}
|
|
214
239
|
}
|
|
215
240
|
}
|
|
216
241
|
if (!isPass) {
|
|
217
|
-
|
|
242
|
+
if (rule.ruleDesc) {
|
|
243
|
+
return rule.ruleDesc
|
|
244
|
+
}
|
|
245
|
+
if (rule.isMatched === 1) {
|
|
246
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
247
|
+
} else {
|
|
248
|
+
return ['EXCLUSION_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
249
|
+
}
|
|
218
250
|
}
|
|
219
251
|
}
|
|
220
252
|
} else if (rule.checkType == 'REGEX') {
|
|
@@ -236,6 +268,9 @@ function IsStringOk(fCfgItem, paramValue) {
|
|
|
236
268
|
}
|
|
237
269
|
}
|
|
238
270
|
if (!isPass) {
|
|
271
|
+
if (rule.ruleDesc) {
|
|
272
|
+
return rule.ruleDesc
|
|
273
|
+
}
|
|
239
274
|
return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
|
|
240
275
|
}
|
|
241
276
|
}
|
|
@@ -270,11 +305,28 @@ function IsIntOk(fCfgItem, paramValue) {
|
|
|
270
305
|
}
|
|
271
306
|
|
|
272
307
|
if (!isPass) {
|
|
308
|
+
if (rule.ruleDesc) {
|
|
309
|
+
return rule.ruleDesc
|
|
310
|
+
}
|
|
273
311
|
return ['WRONG_INT_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
|
|
274
312
|
}
|
|
275
313
|
} else if (rule.checkType == 'ENU') {
|
|
276
|
-
if (rule.exprVal && rule.exprVal.length
|
|
277
|
-
|
|
314
|
+
if (rule.exprVal && rule.exprVal.length) {
|
|
315
|
+
if (rule.isMatched === 1) {
|
|
316
|
+
if (!rule.exprVal.includes(paramValue)) {
|
|
317
|
+
if (rule.ruleDesc) {
|
|
318
|
+
return rule.ruleDesc
|
|
319
|
+
}
|
|
320
|
+
return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
if (rule.exprVal.includes(paramValue)) {
|
|
324
|
+
if (rule.ruleDesc) {
|
|
325
|
+
return rule.ruleDesc
|
|
326
|
+
}
|
|
327
|
+
return ['EXCLUSION_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
278
330
|
}
|
|
279
331
|
} else if (rule.checkType == 'REGEX') {
|
|
280
332
|
let isPass = false
|
|
@@ -295,6 +347,9 @@ function IsIntOk(fCfgItem, paramValue) {
|
|
|
295
347
|
}
|
|
296
348
|
}
|
|
297
349
|
if (!isPass) {
|
|
350
|
+
if (rule.ruleDesc) {
|
|
351
|
+
return rule.ruleDesc
|
|
352
|
+
}
|
|
298
353
|
return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
|
|
299
354
|
}
|
|
300
355
|
}
|