+
{/* Left contact page */}
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(val)}
`,
+ )}${escapeHtml(val).replace(
+ /\n/g,
+ "
"
+ )}
`,
""
);