summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-02 08:22:25 -0700
committerGitHub <noreply@github.com>2018-04-02 08:22:25 -0700
commitcf1688f94a6b7bb8c7f1f9f7ce61553bdec13991 (patch)
tree4ad2a1ac6551ad68d08dc52dd30800e077e2ca56
parent80b3d14b56d685618c745fb6614bda93f59c18e5 (diff)
downloadchat-cf1688f94a6b7bb8c7f1f9f7ce61553bdec13991.tar.gz
chat-cf1688f94a6b7bb8c7f1f9f7ce61553bdec13991.tar.bz2
chat-cf1688f94a6b7bb8c7f1f9f7ce61553bdec13991.zip
Fixing DB load causing user logout. (#8559)
-rw-r--r--api4/context.go6
-rw-r--r--app/session.go2
2 files changed, 6 insertions, 2 deletions
diff --git a/api4/context.go b/api4/context.go
index 1f27431d2..9f3822633 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -125,8 +125,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err != nil {
l4g.Info(utils.T("api.context.invalid_session.error"), err.Error())
- c.RemoveSessionCookie(w, r)
- if h.requireSession {
+ if err.StatusCode == http.StatusInternalServerError {
+ c.Err = err
+ } else if h.requireSession {
+ c.RemoveSessionCookie(w, r)
c.Err = model.NewAppError("ServeHTTP", "api.context.session_expired.app_error", nil, "token="+token, http.StatusUnauthorized)
}
} else if !session.IsOAuth && tokenLocation == app.TokenLocationQueryString {
diff --git a/app/session.go b/app/session.go
index c9208f2b2..43fbf7979 100644
--- a/app/session.go
+++ b/app/session.go
@@ -54,6 +54,8 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
a.AddSessionToCache(session)
}
}
+ } else if sessionResult.Err.StatusCode == http.StatusInternalServerError {
+ return nil, sessionResult.Err
}
}