mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Fix server error checking in API stdin endpoint
This commit is contained in:
parent
e0b0e52bd5
commit
45a1b835fb
@ -1,6 +1,5 @@
|
||||
import logging
|
||||
|
||||
from peewee import DoesNotExist
|
||||
from app.classes.models.server_permissions import EnumPermissionsServer
|
||||
from app.classes.web.base_api_handler import BaseApiHandler
|
||||
|
||||
@ -27,9 +26,9 @@ class ApiServersServerStdinHandler(BaseApiHandler):
|
||||
# if the user doesn't have Commands permission, return an error
|
||||
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||
|
||||
try:
|
||||
svr = self.controller.get_server_obj(server_id)
|
||||
except DoesNotExist:
|
||||
svr = self.controller.get_server_obj_optional(server_id)
|
||||
if svr is None:
|
||||
# It's in auth_data[0] but not as a Server object
|
||||
logger.critical(
|
||||
"Something has gone VERY wrong! "
|
||||
"Crafty can't access the server object. "
|
||||
|
Loading…
x
Reference in New Issue
Block a user