Skip to content

Commit db97ce8

Browse files
authored
Merge pull request #337 from FreeCAD/backport-336-to-main
[Backport main] Translate freecadweb to freecad in macro icon path
2 parents fa638a3 + 2a1a02b commit db97ce8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

MacroCacheCreator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def fetch_macros(self):
7676
self.retrieve_macros_from_wiki()
7777
print("Downloading icons...")
7878
for macro in self.macros.values():
79-
self.get_icon(macro)
79+
try:
80+
self.get_icon(macro)
81+
except RuntimeError as e:
82+
self.macro_errors[macro.name] = str(e)
8083
self.macro_stats["errors"] = len(self.macro_errors)
8184

8285
def create_cache(self) -> str:
@@ -163,6 +166,8 @@ def get_icon(macro: Macro):
163166
"""Downloads the macro's icon from whatever source is specified and stores its binary
164167
contents in self.icon_data"""
165168
if macro.icon.startswith("http://") or macro.icon.startswith("https://"):
169+
if "freecadweb" in macro.icon:
170+
macro.icon = macro.icon.replace("freecadweb", "freecad")
166171
parsed_url = urllib.parse.urlparse(macro.icon)
167172
try:
168173
p = requests.get(macro.icon, headers=headers, timeout=10.0)

0 commit comments

Comments
 (0)