1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-28 13:15:25 +00:00

Fix passwords that contain =

Fixes #1119.

Apparently `split` does not work the way I'd expect.
This commit is contained in:
Asher 2019-10-28 13:44:43 -05:00
parent 3a9b032c72
commit 83ff31b620
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -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;