1
0
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:
Julien Duponchelle 2017-03-13 17:11:37 +01:00
parent 886329a978
commit d60597ca0d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -75,7 +75,10 @@ def import_project(controller, project_id, stream, location=None, name=None, kee
else:
projects_path = controller.projects_directory()
path = os.path.join(projects_path, project_name)
os.makedirs(path, exist_ok=True)
try:
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)
topology = load_topology(os.path.join(path, "project.gns3"))