improve condition when failing api request, check if user exists, afterwards check if user is not active

This commit is contained in:
Kristiyan
2018-11-09 18:17:40 +01:00
parent 9a3dbedc52
commit 2070c8c102

View File

@@ -1098,7 +1098,7 @@ class UserSpawnHandler(BaseHandler):
# otherwise redirect users to their own server
should_spawn = (current_user and current_user.name == user_name)
if "api" in user_path.split("/") and not user.active:
if "api" in user_path.split("/") and user and not user.active:
# API request for not-running server (e.g. notebook UI left open)
# Avoid triggering a spawn.
self._fail_api_request(user)