mirror of
https://github.com/GNS3/gns3-server
synced 2025-08-05 05:15:23 +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()
|
pairs = OrderedDict()
|
||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
# get the first line to read the .encoding value
|
# get the first line to read the .encoding value
|
||||||
with open(path, encoding=encoding) as f:
|
with open(path, "rb") as f:
|
||||||
line = f.readline()
|
line = f.readline().decode(encoding, errors="ignore")
|
||||||
if line.startswith("#!"):
|
if line.startswith("#!"):
|
||||||
# skip the shebang
|
# skip the shebang
|
||||||
line = f.readline()
|
line = f.readline().decode(encoding, errors="ignore")
|
||||||
try:
|
try:
|
||||||
key, value = line.split('=', 1)
|
key, value = line.split('=', 1)
|
||||||
if key.strip().lower() == ".encoding":
|
if key.strip().lower() == ".encoding":
|
||||||
|
Loading…
Reference in New Issue
Block a user