From 13d327321204aec43c2aa58356fc89ac54472257 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Mon, 14 Sep 2020 00:39:01 +0800 Subject: [PATCH] fix(github): check for session.$reply existence --- packages/plugin-github/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/plugin-github/src/index.ts b/packages/plugin-github/src/index.ts index 68e5974c6e..d24450f20e 100644 --- a/packages/plugin-github/src/index.ts +++ b/packages/plugin-github/src/index.ts @@ -137,6 +137,7 @@ export function apply(ctx: Context, config: Config = {}) { }) ctx.on('before-attach-user', (session, fields) => { + if (!session.$reply) return if (history[int32ToHex6(session.$reply)]) { fields.add('ghAccessToken') fields.add('ghRefreshToken') @@ -144,6 +145,7 @@ export function apply(ctx: Context, config: Config = {}) { }) ctx.middleware((session, next) => { + if (!session.$reply) return next() const body = session.$parsed const payloads = history[int32ToHex6(session.$reply)] if (!body || !payloads) return next()