Skip to content

Commit

Permalink
Fix: catch internal error in OneDrive OAuth callback
Browse files Browse the repository at this point in the history
  • Loading branch information
HFO4 committed Apr 7, 2020
1 parent 4aef12b commit 1a1543f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/duo-labs/webauthn v0.0.0-20191119193225-4bf9a0f776d4
github.com/fatih/color v1.7.0
github.com/gin-contrib/cors v1.3.0
github.com/gin-contrib/gzip v0.0.2-0.20200226035851-25bef2ef21e8 // indirect
github.com/gin-contrib/gzip v0.0.2-0.20200226035851-25bef2ef21e8
github.com/gin-contrib/sessions v0.0.1
github.com/gin-contrib/static v0.0.0-20191128031702-f81c604d8ac2
github.com/gin-gonic/gin v1.5.0
Expand Down
6 changes: 5 additions & 1 deletion service/callback/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ func (service *OneDriveOauthService) Auth(c *gin.Context) serializer.Response {
return serializer.ParamErr(service.ErrorMsg, nil)
}

policyID := util.GetSession(c, "onedrive_oauth_policy").(uint)
policyID, ok := util.GetSession(c, "onedrive_oauth_policy").(uint)
if !ok {
return serializer.Err(serializer.CodeNotFound, "授权会话不存在,请重试", nil)
}

util.DeleteSession(c, "onedrive_oauth_policy")

policy, err := model.GetPolicyByID(policyID)
Expand Down

0 comments on commit 1a1543f

Please sign in to comment.