Attempt to remove custom PBA file when resetting config only if filename exists in DB

This commit is contained in:
Shreya 2021-03-25 19:58:50 +05:30
parent 8121f08aa9
commit 4854c9cfc9
1 changed files with 8 additions and 7 deletions
monkey/monkey_island/cc/resources

View File

@ -69,6 +69,7 @@ class FileUpload(flask_restful.Resource):
PBA_LINUX_FILENAME_PATH if file_type == "PBAlinux" else PBA_WINDOWS_FILENAME_PATH
)
filename = ConfigService.get_config_value(filename_path)
if filename:
file_path = Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename)
try:
if os.path.exists(file_path):