diff --git a/monkey/monkey_island/cc/resources/pba_file_upload.py b/monkey/monkey_island/cc/resources/pba_file_upload.py index 46169eb5e..6ae209a12 100644 --- a/monkey/monkey_island/cc/resources/pba_file_upload.py +++ b/monkey/monkey_island/cc/resources/pba_file_upload.py @@ -58,6 +58,24 @@ class FileUpload(flask_restful.Resource): response = Response(response=filename, status=200, mimetype="text/plain") return response + @staticmethod + def upload_pba_file(request_, is_linux=True): + """ + Uploads PBA file to island's file system + :param request_: Request object containing PBA file + :param is_linux: Boolean indicating if this file is for windows or for linux + :return: filename string + """ + filename = secure_filename(request_.files["filepond"].filename) + file_path = ( + Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename).absolute() + ) + request_.files["filepond"].save(str(file_path)) + ConfigService.set_config_value( + (PBA_LINUX_FILENAME_PATH if is_linux else PBA_WINDOWS_FILENAME_PATH), filename + ) + return filename + @jwt_required def delete(self, file_type): """ @@ -76,24 +94,6 @@ class FileUpload(flask_restful.Resource): return {} - @staticmethod - def upload_pba_file(request_, is_linux=True): - """ - Uploads PBA file to island's file system - :param request_: Request object containing PBA file - :param is_linux: Boolean indicating if this file is for windows or for linux - :return: filename string - """ - filename = secure_filename(request_.files["filepond"].filename) - file_path = ( - Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename).absolute() - ) - request_.files["filepond"].save(str(file_path)) - ConfigService.set_config_value( - (PBA_LINUX_FILENAME_PATH if is_linux else PBA_WINDOWS_FILENAME_PATH), filename - ) - return filename - @staticmethod def _delete_file(file_path): try: