Skip to content

Commit

Permalink
url encode error json sent in cookie (#3615)
Browse files Browse the repository at this point in the history
* url encode error json sent in cookie

* use encodeURIComponent instead
  • Loading branch information
deepakprabhakara authored Feb 19, 2025
1 parent e54668c commit 7cecf17
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7cecf17

Please sign in to comment.