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 // makes new comment - C
exports.post = [ exports.post = [
// Validate and sanitize text // 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 // Validate and sanitize text
body("author", "Please enter comment author!") body("author", "Please enter comment author!").isLength({ min: 1 }).trim(),
.isLength({ min: 1 })
.trim()
.escape(),
// Process request after authentication, validation and sanitization // Process request after authentication, validation and sanitization
asyncHandler(async (req, res, next) => { asyncHandler(async (req, res, next) => {

View file

@ -51,16 +51,10 @@ exports.index = asyncHandler(async (req, res, next) => {
// makes new post - C // makes new post - C
exports.post = [ exports.post = [
// Validate and sanitize title // Validate and sanitize title
body("title", "Please enter blog post title!") body("title", "Please enter blog post title!").isLength({ min: 1 }).trim(),
.isLength({ min: 1 })
.trim()
.escape(),
// Validate and sanitize text // Validate and sanitize text
body("text", "Please enter blog post text!") body("text", "Please enter blog post text!").isLength({ min: 1 }).trim(),
.isLength({ min: 1 })
.trim()
.escape(),
asyncHandler(async (req, res, next) => { asyncHandler(async (req, res, next) => {
// then return any validation errors // then return any validation errors
@ -138,16 +132,10 @@ exports.get = asyncHandler(async (req, res, next) => {
// updates post - U // updates post - U
exports.put = [ exports.put = [
// Validate and sanitize title // Validate and sanitize title
body("title", "Please enter blog post title!") body("title", "Please enter blog post title!").isLength({ min: 1 }).trim(),
.isLength({ min: 1 })
.trim()
.escape(),
// Validate and sanitize text // Validate and sanitize text
body("text", "Please enter blog post text!") body("text", "Please enter blog post text!").isLength({ min: 1 }).trim(),
.isLength({ min: 1 })
.trim()
.escape(),
// Process request after sanitization and validation // Process request after sanitization and validation
asyncHandler(async (req, res, next) => { asyncHandler(async (req, res, next) => {