mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Replace "windows-style" line endings (\r\n) by "UNIX-style (\n) for the
IOURC file.
This commit is contained in:
parent
0110fe33d4
commit
54a6e9a7ac
@ -183,11 +183,12 @@ class IOU(IModule):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if "iourc" in request:
|
if "iourc" in request:
|
||||||
base64iourc = base64.decodestring(request["iourc"].encode("utf-8"))
|
iourc_content = base64.decodestring(request["iourc"].encode("utf-8")).decode("utf-8")
|
||||||
|
iourc_content = iourc_content.replace("\r\n", "\n") # dos2unix
|
||||||
try:
|
try:
|
||||||
with tempfile.NamedTemporaryFile(delete=False) as f:
|
with tempfile.NamedTemporaryFile(delete=False) as f:
|
||||||
log.info("saving iourc file content to {}".format(f.name))
|
log.info("saving iourc file content to {}".format(f.name))
|
||||||
f.write(base64iourc)
|
f.write(iourc_content.encode('utf-8'))
|
||||||
self._iourc = f.name
|
self._iourc = f.name
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise IOUError("Could not save iourc file to {}: {}".format(f.name, e))
|
raise IOUError("Could not save iourc file to {}: {}".format(f.name, e))
|
||||||
|
Loading…
Reference in New Issue
Block a user