Skip to content

Fix error decoding macro icon#174

Merged
chennes merged 2 commits into
FreeCAD:mainfrom
chennes:macroIconDecodingError
Aug 15, 2025
Merged

Fix error decoding macro icon#174
chennes merged 2 commits into
FreeCAD:mainfrom
chennes:macroIconDecodingError

Conversation

@chennes
Copy link
Copy Markdown
Member

@chennes chennes commented Aug 14, 2025

Also fixes the error-handling code itself to synchronize the signal signatures between installing a Macro and non-Macro addon. Fixes #173 .

Copilot AI review requested due to automatic review settings August 14, 2025 19:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an error in macro icon decoding by removing the base64 decoding step and synchronizes signal signatures between macro and non-macro addon installers. The changes address issue #173 related to macro icon handling.

  • Removes base64 decoding from icon data when copying macro icons
  • Updates the MacroInstaller failure signal to match the signature used by other installer classes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
addonmanager_macro.py Removes base64.b64decode() call when writing icon data to fix decoding errors
addonmanager_installer.py Adds string parameter to MacroInstaller failure signal for consistency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread addonmanager_macro.py Outdated
with open(os.path.join(macro_dir, filename), "wb") as f:
f.write(base64.b64decode(self.icon_data))
f.write(self.icon_data)
except (OSError, UnicodeDecodeError, binascii.Error) as e:
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception handling includes binascii.Error which is no longer relevant since base64 decoding has been removed. This exception type should be removed from the except clause.

Suggested change
except (OSError, UnicodeDecodeError, binascii.Error) as e:
except (OSError, UnicodeDecodeError) as e:

Copilot uses AI. Check for mistakes.
@chennes chennes force-pushed the macroIconDecodingError branch from e51a29a to 9742407 Compare August 14, 2025 19:07
Also fixes the error-handling code itself to synchronize the signal
signatures between installing an Macro and non-Macro addon.
@chennes chennes force-pushed the macroIconDecodingError branch from 9742407 to 7ef0500 Compare August 14, 2025 19:08
@chennes chennes merged commit 9db4777 into FreeCAD:main Aug 15, 2025
11 checks passed
@chennes chennes deleted the macroIconDecodingError branch August 15, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Easy Alias macro fails installation via Addon Manager

2 participants