mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
parent
ac8bd3fec4
commit
cf10f02a8d
@ -648,7 +648,7 @@ class Project:
|
||||
topo = project_to_topology(self)
|
||||
path = self._topology_file()
|
||||
log.debug("Write %s", path)
|
||||
with open(path + ".tmp", "w+") as f:
|
||||
with open(path + ".tmp", "w+", encoding="utf-8") as f:
|
||||
json.dump(topo, f, indent=4, sort_keys=True)
|
||||
shutil.move(path + ".tmp", path)
|
||||
except OSError as e:
|
||||
|
@ -89,7 +89,7 @@ def load_topology(path):
|
||||
"""
|
||||
log.debug("Read topology %s", path)
|
||||
try:
|
||||
with open(path) as f:
|
||||
with open(path, encoding="utf-8") as f:
|
||||
topo = json.load(f)
|
||||
except (OSError, UnicodeEncodeError, json.JSONDecodeError) as e:
|
||||
raise aiohttp.web.HTTPConflict(text="Could not load topology {}: {}".format(path, str(e)))
|
||||
@ -98,7 +98,7 @@ def load_topology(path):
|
||||
# first we backup the file
|
||||
shutil.copy(path, path + ".backup")
|
||||
topo = _convert_1_3_later(topo, path)
|
||||
with open(path, "w+") as f:
|
||||
with open(path, "w+", encoding="utf-8") as f:
|
||||
json.dump(topo, f)
|
||||
elif topo["revision"] > GNS3_FILE_FORMAT_REVISION:
|
||||
raise aiohttp.web.HTTPConflict(text="This project is designed for a more recent version of GNS3 please update GNS3 to version {} or later".format(topo["version"]))
|
||||
|
Loading…
Reference in New Issue
Block a user