Prevent deleting a GNS3 project outside the project directory. Ref #1669

This commit is contained in:
grossmj
2019-10-30 16:25:06 +08:00
parent f3ad333a21
commit 5e9810d420
2 changed files with 7 additions and 3 deletions

View File

@ -204,11 +204,12 @@ class ProjectHandler:
controller = Controller.instance()
config = Config.instance()
dot_gns3_file = request.json.get("path")
if config.get_section_config("Server").getboolean("local", False) is False:
log.error("Can't load the project the server is not started with --local")
log.error("Cannot load '{}' because the server has not been started with the '--local' parameter".format(dot_gns3_file))
response.set_status(403)
return
project = await controller.load_project(request.json.get("path"),)
project = await controller.load_project(dot_gns3_file,)
response.set_status(201)
response.json(project)