Skip to content

Conversation

@prnndk
Copy link

@prnndk prnndk commented Dec 9, 2025

When processing artifacts, the user_defaults module crashed with an AttributeError: 'str' object has no attribute 'items'.

This occurs because, in some instances, the plist loader returns a string (e.g., when a previous exception handler sets the plist content to "INVALID FILE") or fails to load a dictionary structure, but the code attempts to iterate over it using .items() without validation.

Changes Made

Added Type Validation: Implemented isinstance(plist, dict) checks before attempting to iterate through plist.items(). This ensures that only valid dictionary objects are processed.

Enhanced Error Handling: Wrapped the file processing loop in a try-except block to gracefully handle InvalidFileException or other generic exceptions.

Safety Checks: Added a check for MCMMetadataIdentifier to ensure the plist contains the necessary metadata before processing, preventing potential KeyErrors.

Test Result:
image

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.

1 participant