Catch unicode error when you try to duplicate a project with invalid characters

Fix #934
pull/935/head
Julien Duponchelle 7 years ago
parent 886329a978
commit d60597ca0d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -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"))

Loading…
Cancel
Save