Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

修复cookie的value在含有未编码的“=”的情况下,未能正确的获取. #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/parse-cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const parseCookies = (s: string): { [key: string]: string } => {
const parsed: { [key: string]: string } = {};
const pattern = new RegExp("\\s*;\\s*");
s.split(pattern).forEach((i) => {
const [encodedKey, encodedValue] = i.split("=");
const [encodedKey, ...encodedValueList] = i.split("=");
const key = decodeURIComponent(encodedKey);
const value = decodeURIComponent(encodedValue);
const value = decodeURIComponent(encodedValueList.join("="));
parsed[key] = value;
});
return parsed;
Expand Down