forked from p15670423/monkey
Attempt to remove custom PBA file when resetting config only if filename exists in DB
This commit is contained in:
parent
8121f08aa9
commit
4854c9cfc9
|
@ -69,13 +69,14 @@ 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)
|
||||
file_path = Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename)
|
||||
try:
|
||||
if os.path.exists(file_path):
|
||||
os.remove(file_path)
|
||||
ConfigService.set_config_value(filename_path, "")
|
||||
except OSError as e:
|
||||
LOG.error("Can't remove previously uploaded post breach files: %s" % e)
|
||||
if filename:
|
||||
file_path = Path(env_singleton.env.get_config().data_dir_abs_path).joinpath(filename)
|
||||
try:
|
||||
if os.path.exists(file_path):
|
||||
os.remove(file_path)
|
||||
ConfigService.set_config_value(filename_path, "")
|
||||
except OSError as e:
|
||||
LOG.error("Can't remove previously uploaded post breach files: %s" % e)
|
||||
|
||||
return {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue