Skip to content

Commit

Permalink
fix(github): check for session.$reply existence
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Sep 13, 2020
1 parent ec3b26c commit 13d3273
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ 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')
}
})

ctx.middleware((session, next) => {
if (!session.$reply) return next()
const body = session.$parsed
const payloads = history[int32ToHex6(session.$reply)]
if (!body || !payloads) return next()
Expand Down

0 comments on commit 13d3273

Please sign in to comment.