From 7cecf17e7ed7cae1d0eb843949b611af7fc50862 Mon Sep 17 00:00:00 2001 From: Deepak Prabhakara Date: Wed, 19 Feb 2025 11:28:50 +0000 Subject: [PATCH] url encode error json sent in cookie (#3615) * url encode error json sent in cookie * use encodeURIComponent instead --- lib/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.ts b/lib/utils.ts index e0a192dd8..caf0b4f82 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -21,7 +21,7 @@ export const validateEmailWithACL = (email: string) => { */ export const setErrorCookie = (res: NextApiResponse, value: unknown, options: { path?: string } = {}) => { const stringValue = typeof value === 'object' ? JSON.stringify(value) : String(value); - let cookieContents = 'jackson_error' + '=' + stringValue; + let cookieContents = 'jackson_error' + '=' + encodeURIComponent(stringValue); if (options.path) { cookieContents += '; Path=' + options.path; }