Skip to content

Commit 83ff31b

Browse files
committed
Fix passwords that contain =
Fixes #1119. Apparently `split` does not work the way I'd expect.
1 parent 3a9b032 commit 83ff31b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/node/server.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,11 @@ export abstract class Server {
440440
const cookies: { [key: string]: string } = {};
441441
if (request.headers.cookie) {
442442
request.headers.cookie.split(";").forEach((keyValue) => {
443-
const [key, value] = keyValue.split("=", 2);
444-
cookies[key.trim()] = decodeURI(value);
443+
// key=value -> { [key]: value } and key -> { [key]: "" }
444+
const index = keyValue.indexOf("=");
445+
const key = keyValue.substring(0, index).trim();
446+
const value = keyValue.substring(index + 1);
447+
cookies[key || value] = decodeURI(key ? value : "");
445448
});
446449
}
447450
return cookies as T;

0 commit comments

Comments
 (0)