From fa747fad568f483649304f2669d8379e079ae9d6 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Mon, 13 Sep 2021 12:55:44 +0200 Subject: [PATCH] [freecodecamp]: allow + symbol in username --- services/freecodecamp/freecodecamp-points.service.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/freecodecamp/freecodecamp-points.service.js b/services/freecodecamp/freecodecamp-points.service.js index 8ec55b5aa4fa8..acf8fb0daa590 100644 --- a/services/freecodecamp/freecodecamp-points.service.js +++ b/services/freecodecamp/freecodecamp-points.service.js @@ -2,11 +2,17 @@ import Joi from 'joi' import { metric } from '../text-formatters.js' import { BaseJsonService, InvalidResponse, NotFound } from '../index.js' +/** + * Validates that the schema response is what we're expecting. + * The username pattern should match the freeCodeCamp repository. + * + * @see https://github.com/freeCodeCamp/freeCodeCamp/blob/main/utils/validate.js#L14 + */ const schema = Joi.object({ entities: Joi.object({ user: Joi.object() .required() - .pattern(/^\w+$/, { + .pattern(/^[a-zA-Z0-9\-_+]*$/, { points: Joi.number().allow(null).required(), }), }).optional(),