diff --git a/lib/app.js b/lib/app.js index 9ed9fbafea..dbf036e4c6 100644 --- a/lib/app.js +++ b/lib/app.js @@ -10,7 +10,6 @@ const errorHandler = require('errorhandler'); const unleashSession = require('./middleware/session'); const responseTime = require('./middleware/response-time'); const requestLogger = require('./middleware/request-logger'); -const validator = require('./middleware/validator'); const simpleAuthentication = require('./middleware/simple-authentication'); module.exports = function(config) { @@ -33,7 +32,6 @@ module.exports = function(config) { app.use(unleashSession(config)); app.use(responseTime(config)); app.use(requestLogger(config)); - app.use(validator(config)); if (config.publicFolder) { app.use(favicon(path.join(config.publicFolder, 'favicon.ico'))); diff --git a/lib/error/validate-request.js b/lib/error/validate-request.js deleted file mode 100644 index 21066c695e..0000000000 --- a/lib/error/validate-request.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -const ValidationError = require('./validation-error'); - -function validateRequest(req) { - return new Promise((resolve, reject) => { - if (req.validationErrors()) { - reject(new ValidationError('Invalid syntax')); - } else { - resolve(req); - } - }); -} - -module.exports = validateRequest; diff --git a/lib/middleware/validator.js b/lib/middleware/validator.js deleted file mode 100644 index 0cb71c33d3..0000000000 --- a/lib/middleware/validator.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -const validator = require('express-validator'); - -module.exports = function() { - return validator({ - customValidators: { - isUrlFriendlyName: input => encodeURIComponent(input) === input, - }, - }); -}; diff --git a/package.json b/package.json index f72599eed2..ad74389c30 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,6 @@ "deep-diff": "^1.0.0", "errorhandler": "^1.5.0", "express": "^4.16.3", - "express-validator": "^5.2.0", "gravatar": "^1.6.0", "install": "^0.12.0", "joi": "^14.0.0", diff --git a/yarn.lock b/yarn.lock index 628713e686..41736b3ad8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2352,14 +2352,6 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -express-validator@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/express-validator/-/express-validator-5.2.0.tgz#28f068fc676022acfe182c97fd9e780f9ffb26f6" - integrity sha512-FyQ7gAaNwnIYvtfagy+fDrtzjNDFKRVjzplCPDXEu8fxSR/XBdXZHAtLR22446GWlw48LZPSKldqUVmySBWApA== - dependencies: - lodash "^4.17.10" - validator "^10.1.0" - express@^4.16.3: version "4.16.3" resolved "https://registry.yarnpkg.com/express/-/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53" @@ -7232,11 +7224,6 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" -validator@^10.1.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/validator/-/validator-10.2.0.tgz#61d6b10c3d5c9f368c75c2ce8ca2b792522eaafa" - integrity sha512-gz/uknWtNfZTj1BLUzYHDxOoiQ7A4wZ6xPuuE6RpxswR4cNyT4I5kN9jmU0AQr7IBEap9vfYChI2TpssTN6Itg== - vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"