From b9eece487b76c6756008a477f5d2bd7f1d969592 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Mon, 19 Dec 2022 10:13:58 -0500 Subject: [PATCH] Revert "#729 decode HTML entities in names prior to storing in the database" This reverts commit 7ad11ae1f9a9aaa61dcd51900799ceea5b8713fd. --- package-lock.json | 11 -------- package.json | 1 - .../org.controller/org.controller.js | 25 +++++++++---------- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2abc22332..b73a5bbf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "express-rate-limit": "^6.5.2", "express-validator": "^6.12.0", "helmet": "^3.21.2", - "html-entities": "^2.3.3", "jsonschema": "^1.4.0", "JSONStream": "^1.3.5", "kleur": "^4.1.4", @@ -4416,11 +4415,6 @@ "node": ">= 0.8" } }, - "node_modules/html-entities": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", - "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==" - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -13501,11 +13495,6 @@ } } }, - "html-entities": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", - "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==" - }, "html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", diff --git a/package.json b/package.json index 368dec17c..10261c026 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "express-rate-limit": "^6.5.2", "express-validator": "^6.12.0", "helmet": "^3.21.2", - "html-entities": "^2.3.3", "jsonschema": "^1.4.0", "JSONStream": "^1.3.5", "kleur": "^4.1.4", diff --git a/src/controller/org.controller/org.controller.js b/src/controller/org.controller/org.controller.js index 500a856e5..b9d6728a7 100644 --- a/src/controller/org.controller/org.controller.js +++ b/src/controller/org.controller/org.controller.js @@ -9,7 +9,6 @@ const uuid = require('uuid') const errors = require('./error') const error = new errors.OrgControllerError() const uuidAPIKey = require('uuid-apikey') -const decodeEntities = require('html-entities').decode /** * Get the details of all orgs @@ -244,9 +243,9 @@ async function createOrg (req, res, next) { const key = k.toLowerCase() if (key === 'short_name') { - newOrg.short_name = decodeEntities(req.ctx.body.short_name) + newOrg.short_name = req.ctx.body.short_name } else if (key === 'name') { - newOrg.name = decodeEntities(req.ctx.body.name) + newOrg.name = req.ctx.body.name } else if (key === 'authority') { if (req.ctx.body.authority.active_roles) { newOrg.authority.active_roles = req.ctx.body.authority.active_roles @@ -325,10 +324,10 @@ async function updateOrg (req, res, next) { const key = k.toLowerCase() if (key === 'new_short_name') { - newOrg.short_name = decodeEntities(req.ctx.query.new_short_name) + newOrg.short_name = req.ctx.query.new_short_name agt = setAggregateOrgObj({ short_name: newOrg.short_name }) } else if (key === 'name') { - newOrg.name = decodeEntities(req.ctx.query.name) + newOrg.name = req.ctx.query.name } else if (key === 'id_quota') { newOrg.policies.id_quota = req.ctx.query.id_quota } else if (key === 'active_roles.add') { @@ -439,16 +438,16 @@ async function createUser (req, res, next) { } } else if (key === 'name') { if (req.ctx.body.name.first) { - newUser.name.first = decodeEntities(req.ctx.body.name.first) + newUser.name.first = req.ctx.body.name.first } if (req.ctx.body.name.last) { - newUser.name.last = decodeEntities(req.ctx.body.name.last) + newUser.name.last = req.ctx.body.name.last } if (req.ctx.body.name.middle) { - newUser.name.middle = decodeEntities(req.ctx.body.name.middle) + newUser.name.middle = req.ctx.body.name.middle } if (req.ctx.body.name.suffix) { - newUser.name.suffix = decodeEntities(req.ctx.body.name.suffix) + newUser.name.suffix = req.ctx.body.name.suffix } } else if (key === 'org_uuid') { return res.status(400).json(error.uuidProvided()) @@ -576,13 +575,13 @@ async function updateUser (req, res, next) { return res.status(403).json(error.notAllowedToChangeOrganization()) } } else if (key === 'name.first') { - newUser.name.first = decodeEntities(req.ctx.query['name.first']) + newUser.name.first = req.ctx.query['name.first'] } else if (key === 'name.last') { - newUser.name.last = decodeEntities(req.ctx.query['name.last']) + newUser.name.last = req.ctx.query['name.last'] } else if (key === 'name.middle') { - newUser.name.middle = decodeEntities(req.ctx.query['name.middle']) + newUser.name.middle = req.ctx.query['name.middle'] } else if (key === 'name.suffix') { - newUser.name.suffix = decodeEntities(req.ctx.query['name.suffix']) + newUser.name.suffix = req.ctx.query['name.suffix'] } else if (key === 'active') { newUser.active = req.ctx.query.active changesRequirePrivilegedRole = true