From a9b992efad9280d68f02807ef9094b46bb7adb39 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 3 Sep 2022 18:02:35 +0200 Subject: [PATCH] fix(sendRedirect): only encode required chars in meta tag --- src/utils/response.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/utils/response.ts b/src/utils/response.ts index efde25be..a6c70116 100644 --- a/src/utils/response.ts +++ b/src/utils/response.ts @@ -24,15 +24,10 @@ export function defaultContentType (event: CompatibilityEvent, type?: string) { } export function sendRedirect (event: CompatibilityEvent, location: string, code = 302) { - const encodedLoc = encodeURI(decodeURI(location)) event.res.statusCode = code - event.res.setHeader('Location', encodedLoc) - // Minimal html document that redirects on client side - const html = ` - - - Redirecting to ${encodedLoc} -` + event.res.setHeader('Location', location) + const encodedLoc = location.replace(/"/g, '%22') + const html = `` return send(event, html, MIMES.html) }