Correction controller links

This commit is contained in:
Silversthorn 2021-09-28 18:40:31 +02:00
parent f1fd90447b
commit 93d3816f3a

View File

@ -19,7 +19,7 @@ MAX_STREAMED_SIZE = 1024 * 1024 * 1024
@tornado.web.stream_request_body
class UploadHandler(tornado.web.RequestHandler):
def initialize(self, controller : Controller = None):
self.controller = controller
@ -34,13 +34,13 @@ class UploadHandler(tornado.web.RequestHandler):
logger.warning('User ID not found in upload handler call')
console.warning('User ID not found in upload handler call')
self.do_upload = False
if server_id is None:
logger.warning('Server ID not found in upload handler call')
console.warning('Server ID not found in upload handler call')
self.do_upload = False
user_permissions = self.controller.server_permissions.get_user_permissions_list(user_id, server_id)
user_permissions = self.controller.server_perms.get_user_permissions_list(user_id, server_id)
if Enum_Permissions_Server.Files not in user_permissions:
logger.warning(f'User {user_id} tried to upload a file to {server_id} without permissions!')
console.warning(f'User {user_id} tried to upload a file to {server_id} without permissions!')
@ -55,7 +55,7 @@ class UploadHandler(tornado.web.RequestHandler):
logger.warning(f'User {user_id} tried to upload a file to {server_id} but the path is not inside of the server!')
console.warning(f'User {user_id} tried to upload a file to {server_id} but the path is not inside of the server!')
self.do_upload = False
if self.do_upload:
try:
self.f = open(full_path, "wb")
@ -68,7 +68,7 @@ class UploadHandler(tornado.web.RequestHandler):
def post(self):
logger.info("Upload completed")
files_left = int(self.request.headers.get('X-Files-Left', None))
if self.do_upload:
time.sleep(5)
if files_left == 0: