Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MACOS Zip Import Error when compressing plugin #3629

Merged
merged 5 commits into from
May 2, 2023
Merged

Fix MACOS Zip Import Error when compressing plugin #3629

merged 5 commits into from
May 2, 2023

Conversation

gravelBridge
Copy link
Contributor

@gravelBridge gravelBridge commented May 1, 2023

Background

When a user on MacOS downloads a folder for a plugin, and compresses it via the built in MacOS compress feature, a hidden directory __MACOSX is created inside the zipped file. It will result in this error when trying to import that zipped plugin:
zipimport.ZipImportError: can't find module '__MACOSX/plugin_name'

Changes

This fix adds a check to see if the plugin starts with __MACOSX and if it does, the file is ignored.

Documentation

I did not document my changes, as the change is very minor, and is just testing an edge case.

Test Plan

I tested multiple plugins from the official plugins repo, with and without the fix. Each time, after I zipped a plugin, I got the zip import error when loading the plugin. However, after the fix, no zip import errors occurred.

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

Added an edge case test to make sure that the temporary hidden file created by MacOS when compressing a folder is not checked. If this is not there, a zip import error will occur.
@vercel
Copy link

vercel bot commented May 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) May 2, 2023 3:45am

@github-actions github-actions bot added the size/s label May 1, 2023
@ntindle ntindle self-assigned this May 1, 2023
@codecov
Copy link

codecov bot commented May 1, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1d26f6b) 60.55% compared to head (7a62200) 60.55%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3629   +/-   ##
=======================================
  Coverage   60.55%   60.55%           
=======================================
  Files          69       69           
  Lines        3189     3189           
  Branches      529      529           
=======================================
  Hits         1931     1931           
  Misses       1123     1123           
  Partials      135      135           
Impacted Files Coverage Δ
autogpt/plugins.py 74.43% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ntindle ntindle added this to the v0.3.0 release milestone May 2, 2023
@ntindle ntindle merged commit 2e9c80a into Significant-Gravitas:master May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants