mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-19 14:58:07 +00:00
Fixes UnicodeDecodeError when reading a VMware file.
This commit is contained in:
parent
a721d7d910
commit
f761fb77f8
@ -242,11 +242,11 @@ class VMware(BaseManager):
|
||||
pairs = OrderedDict()
|
||||
encoding = "utf-8"
|
||||
# get the first line to read the .encoding value
|
||||
with open(path, encoding=encoding) as f:
|
||||
line = f.readline()
|
||||
with open(path, "rb") as f:
|
||||
line = f.readline().decode(encoding, errors="ignore")
|
||||
if line.startswith("#!"):
|
||||
# skip the shebang
|
||||
line = f.readline()
|
||||
line = f.readline().decode(encoding, errors="ignore")
|
||||
try:
|
||||
key, value = line.split('=', 1)
|
||||
if key.strip().lower() == ".encoding":
|
||||
|
Loading…
Reference in New Issue
Block a user