Fix: OSX file metadata messing with workfiles zips - #142
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Harmony client zip/unzip logic to ignore macOS Finder-generated metadata entries (e.g. __MACOSX/, ._*, .DS_Store) so workfile archives unzip into the expected scene structure when ingested (e.g. via Tray Publisher) and opened via AYON Launcher.
Changes:
- Add
_is_macos_metadata_entryhelper to detect macOS metadata/junk zip entries. - Filter out macOS metadata from
unzip_scene_file’s name list and skip extracting those entries. - Skip adding macOS metadata files when creating archives in
zip_and_move.
Suppressed comments (1)
client/ayon_harmony/api/lib.py:519
main_name = next(...)will raiseStopIterationwhen the archive (after filtering macOS metadata) contains no.xstageentry, resulting in a confusing exception instead of a clear user-facing error. Consider guarding this and raising an explicitException(or a more specific error) when no.xstageis present.
names = [
name for name in zip_ref.namelist()
if not _is_macos_metadata_entry(name)
]
main_name = next(
Path(name).stem
for name in names
if name.endswith(".xstage")
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Ignoring OSX file system metadata during zip/unzip processes to avoid messed structures.
Additional review information
In case you ingest manually (tray publisher) harmony scenes you zipped using finder's tool the associated
__MACOSXdirectory breaks the unzipping process.Testing notes: