From e64de3f4b99a0c6ac9bbba1a21b8984cd34f7a79 Mon Sep 17 00:00:00 2001 From: Cypro Freelance <110410268+Proxyy587@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:59:16 +0530 Subject: [PATCH]
fixing #1 --- app/(root)/contact/page.tsx | 44 +++++++++++++++++++++++++++---------- app/api/contact/route.ts | 13 ++++++----- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/app/(root)/contact/page.tsx b/app/(root)/contact/page.tsx index 5a8b066..1755a67 100644 --- a/app/(root)/contact/page.tsx +++ b/app/(root)/contact/page.tsx @@ -1,6 +1,6 @@ "use client"; import Iconss from "@/components/ui/icons"; -import { MapPin, Phone, Mail, Send } from "lucide-react"; +import { Mail, Send, WebhookIcon, Bug, Shield } from "lucide-react"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -79,7 +79,7 @@ const ContactUs = () => {
-
+
{/* Left contact page */}
{

- © ALL RIGHTS RESERVED + © ALL RIGHTS RESERVED SVRJS
diff --git a/app/api/contact/route.ts b/app/api/contact/route.ts index dc681f2..4be3e52 100644 --- a/app/api/contact/route.ts +++ b/app/api/contact/route.ts @@ -12,17 +12,15 @@ const escapeHtml = (text: string) => { .replace(/&/g, "&") .replace(//g, ">") - .replace(/\n/g, "
"); + .replace(/"/g, """) + .replace(/'/g, "'"); }; const generateEmailContent = (data: Record) => { const stringData = Object.entries(data).reduce( (str, [key, val]) => str + - `${CONTACT_MESSAGE_FIELDS[key] || key}: ${val.replace( - /\n/g, - "
" - )}

`, + `${CONTACT_MESSAGE_FIELDS[key] || key}: ${val.replace(/\n/g, "\n")} \n\n`, "" ); @@ -31,7 +29,10 @@ const generateEmailContent = (data: Record) => { str + `

${escapeHtml( CONTACT_MESSAGE_FIELDS[key] || key - )}

${escapeHtml(val)}

`, + )}

${escapeHtml(val).replace( + /\n/g, + "
" + )}

`, "" );