removed escape sanitizer in blog posts and comments

This commit is contained in:
ak 2023-09-30 23:40:34 -07:00
parent bbfb0f9f05
commit 1ed79bc563
2 changed files with 6 additions and 21 deletions

View file

@ -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) => {

View file

@ -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) => {