mirror of
https://github.com/outline/outline.git
synced 2026-11-27 07:58:51 +03:00
Improve error handling on cookie parsing, closes #4246
This commit is contained in:
1 parent
051c79d651
commit
b1cd19df2f
1 file changed
+7
-3
@@ -16,9 +16,13 @@ import { User, Event, Team, Collection, View } from "@server/models";
|
||||
* @returns The session details
|
||||
*/
|
||||
export function getSessionsInCookie(ctx: Context) {
|
||||
return JSON.parse(
|
||||
decodeURIComponent(ctx.cookies.get("sessions") || "") || "{}"
|
||||
);
|
||||
try {
|
||||
const sessionCookie = ctx.cookies.get("sessions") || "";
|
||||
const decodedSessionCookie = decodeURIComponent(sessionCookie);
|
||||
return decodedSessionCookie ? JSON.parse(decodedSessionCookie) : {};
|
||||
} catch (err) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
export async function signIn(
|
||||
|
||||
Reference in new issue
Block a user