From 05ed9836e49202a647c91bd56e4ded54f9f3eec4 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 17 Jul 2020 15:33:30 +0930 Subject: [PATCH] Fix tests. --- gns3server/handlers/api/controller/project_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gns3server/handlers/api/controller/project_handler.py b/gns3server/handlers/api/controller/project_handler.py index 738d833a..bbe4582e 100644 --- a/gns3server/handlers/api/controller/project_handler.py +++ b/gns3server/handlers/api/controller/project_handler.py @@ -382,8 +382,11 @@ class ProjectHandler: # It could be more optimal to stream this but it is not implemented in Python. try: begin = time.time() - # use the parent directory as a temporary working dir - working_dir = os.path.abspath(os.path.join(path, os.pardir)) + # use the parent directory or projects dir as a temporary working dir + if path: + working_dir = os.path.abspath(os.path.join(path, os.pardir)) + else: + working_dir = controller.projects_directory() with tempfile.TemporaryDirectory(dir=working_dir) as tmpdir: temp_project_path = os.path.join(tmpdir, "project.zip") async with aiofiles.open(temp_project_path, 'wb') as f: