mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +00:00
Catch unicode error when you try to duplicate a project with invalid characters
Fix #934
This commit is contained in:
parent
886329a978
commit
d60597ca0d
@ -75,7 +75,10 @@ def import_project(controller, project_id, stream, location=None, name=None, kee
|
|||||||
else:
|
else:
|
||||||
projects_path = controller.projects_directory()
|
projects_path = controller.projects_directory()
|
||||||
path = os.path.join(projects_path, project_name)
|
path = os.path.join(projects_path, project_name)
|
||||||
|
try:
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
except UnicodeEncodeError as e:
|
||||||
|
raise aiohttp.web.HTTPConflict(text="The project name contain non supported or invalid characters")
|
||||||
myzip.extractall(path)
|
myzip.extractall(path)
|
||||||
|
|
||||||
topology = load_topology(os.path.join(path, "project.gns3"))
|
topology = load_topology(os.path.join(path, "project.gns3"))
|
||||||
|
Loading…
Reference in New Issue
Block a user