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: ignore __MACOSX in zips/tarballs, as it only contains MacOS metadata #395

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions bananas_api/new_upload/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def _find_root_folder(info_list, get_name=None, is_file=None):
if not is_file(info):
continue

# Help out MacOS users, and completely ignore this metadata folder it tends to create.
if get_name(info).startswith("__MACOSX/"):
continue

if root_folder is None:
root_folder = get_name(info).split("/")[0]

Expand Down Expand Up @@ -57,6 +61,10 @@ def _extract_files(info_list, root_folder, extractor, extractor_kwargs, get_name
"errors": [],
}

# Help out MacOS users, and completely ignore this metadata folder it tends to create.
if new_file["filename"].startswith("__MACOSX/"):
continue

# Remove the root-folder from the filename if needed.
if root_folder:
new_file["filename"] = new_file["filename"][len(root_folder) + 1 :]
Expand Down