Fix: catch internal error in OneDrive OAuth callback

pull/289/head
HFO4 5 years ago
parent 4aef12bf7e
commit 1a1543f190

@ -1 +1 @@
Subproject commit a576b16440a9fc8268685a7120069443907a4de4
Subproject commit 15a7805c2e1dc90a4c92c8165ce44d0f315a5d39

@ -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

@ -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)

Loading…
Cancel
Save