From 83ff31b620a1affe65888663c0e1da2d391d80ee Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 28 Oct 2019 13:44:43 -0500 Subject: [PATCH] Fix passwords that contain `=` Fixes #1119. Apparently `split` does not work the way I'd expect. --- src/node/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node/server.ts b/src/node/server.ts index 505f6657..ed96fbce 100644 --- a/src/node/server.ts +++ b/src/node/server.ts @@ -440,8 +440,11 @@ export abstract class Server { const cookies: { [key: string]: string } = {}; if (request.headers.cookie) { request.headers.cookie.split(";").forEach((keyValue) => { - const [key, value] = keyValue.split("=", 2); - cookies[key.trim()] = decodeURI(value); + // key=value -> { [key]: value } and key -> { [key]: "" } + const index = keyValue.indexOf("="); + const key = keyValue.substring(0, index).trim(); + const value = keyValue.substring(index + 1); + cookies[key || value] = decodeURI(key ? value : ""); }); } return cookies as T;