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:
parent
3a9b032c72
commit
83ff31b620
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user