forked from p15670423/monkey
Rearrange functions' order in `monkey_island/cc/resources/pba_file_upload.py` to follow stepdown rule
This commit is contained in:
parent
4f94e9de74
commit
9b38303346
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue