Skip to content

Commit

Permalink
Addon Manager: Catch unicode decode failures
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Nov 5, 2022
1 parent 0bd3f9d commit 83f4b2c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Mod/AddonManager/addonmanager_workers.py
Expand Up @@ -1554,7 +1554,12 @@ def process_metadata_txt(self, repo: Addon, data: QtCore.QByteArray):
repo.display_name
)
)
f = io.StringIO(data.data().decode("utf8"))
try:
f = io.StringIO(data.data().decode("utf8"))
except UnicodeDecodeError as e:
FreeCAD.Console.PrintWarning(str(e))
FreeCAD.Console.PrintWarning(f" in package {repo.name}\n")
return
while True:
line = f.readline()
if not line:
Expand Down Expand Up @@ -1603,7 +1608,12 @@ def process_requirements_txt(self, repo: Addon, data: QtCore.QByteArray):
"Downloaded requirements.txt for {}",
).format(repo.display_name)
)
f = io.StringIO(data.data().decode("utf8"))
try:
f = io.StringIO(data.data().decode("utf8"))
except UnicodeDecodeError as e:
FreeCAD.Console.PrintWarning(str(e))
FreeCAD.Console.PrintWarning(f" in package {repo.name}\n")
return
lines = f.readlines()
for line in lines:
break_chars = " <>=~!+#"
Expand Down

0 comments on commit 83f4b2c

Please sign in to comment.