未验证 提交 83ff31b6 编写于 作者: A Asher

Fix passwords that contain `=`

Fixes #1119.

Apparently `split` does not work the way I'd expect.
上级 3a9b032c
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册