From 1ed79bc563c78971a4462ce844d5c5ec3f43062e Mon Sep 17 00:00:00 2001 From: ak Date: Sat, 30 Sep 2023 23:40:34 -0700 Subject: [PATCH] removed escape sanitizer in blog posts and comments --- controllers/comment.js | 7 ++----- controllers/post.js | 20 ++++---------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/controllers/comment.js b/controllers/comment.js index 3b41af0..fdb435e 100644 --- a/controllers/comment.js +++ b/controllers/comment.js @@ -7,13 +7,10 @@ const Comment = require("../models/comment.js"); // makes new comment - C exports.post = [ // Validate and sanitize text - body("text", "Please enter comment!").isLength({ min: 1 }).trim().escape(), + body("text", "Please enter comment!").isLength({ min: 1 }).trim(), // Validate and sanitize text - body("author", "Please enter comment author!") - .isLength({ min: 1 }) - .trim() - .escape(), + body("author", "Please enter comment author!").isLength({ min: 1 }).trim(), // Process request after authentication, validation and sanitization asyncHandler(async (req, res, next) => { diff --git a/controllers/post.js b/controllers/post.js index d469327..24dea6a 100644 --- a/controllers/post.js +++ b/controllers/post.js @@ -51,16 +51,10 @@ exports.index = asyncHandler(async (req, res, next) => { // makes new post - C exports.post = [ // Validate and sanitize title - body("title", "Please enter blog post title!") - .isLength({ min: 1 }) - .trim() - .escape(), + body("title", "Please enter blog post title!").isLength({ min: 1 }).trim(), // Validate and sanitize text - body("text", "Please enter blog post text!") - .isLength({ min: 1 }) - .trim() - .escape(), + body("text", "Please enter blog post text!").isLength({ min: 1 }).trim(), asyncHandler(async (req, res, next) => { // then return any validation errors @@ -138,16 +132,10 @@ exports.get = asyncHandler(async (req, res, next) => { // updates post - U exports.put = [ // Validate and sanitize title - body("title", "Please enter blog post title!") - .isLength({ min: 1 }) - .trim() - .escape(), + body("title", "Please enter blog post title!").isLength({ min: 1 }).trim(), // Validate and sanitize text - body("text", "Please enter blog post text!") - .isLength({ min: 1 }) - .trim() - .escape(), + body("text", "Please enter blog post text!").isLength({ min: 1 }).trim(), // Process request after sanitization and validation asyncHandler(async (req, res, next) => {