Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

[QUAD] Bug: Replace ast.literal_eval with json.loads to avoid crashes on Unreal #6318

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ccaillot
Copy link

No description provided.

@@ -110,9 +110,10 @@ def collect_instances(self):
for instance in self.collection_shared_data[
"unreal_cached_subsets"].get(self.identifier, []):
# Unreal saves metadata as string, so we need to convert it back
instance['creator_attributes'] = ast.literal_eval(
# Not using ast.literal_eval since your can have issues with quotes/formatting
Copy link

Choose a reason for hiding this comment

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

line too long (90 > 79 characters)

@ynbot ynbot added host: UE size/XS Denotes a PR changes 0-99 lines, ignoring general files labels Sep 11, 2024
@moonyuet
Copy link
Member

@ccaillot in the ayon-unreal, some attributes from instance data (and these are not dict value) are also converted.
Have you tried the implementation below as json.loads would error out these attributes with the non-dict type value?

            instance['creator_attributes'] = json.loads(
                instance.get('creator_attributes', '{}'))
            instance['publish_attributes'] = json.loads(
                instance.get('publish_attributes', '{}'))
            instance['members'] = ast.literal_eval(
                instance.get('members', '[]'))
            instance['families'] = ast.literal_eval(
                instance.get('families', '[]'))
            instance['active'] = ast.literal_eval(
                instance.get('active', ''))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: UE size/XS Denotes a PR changes 0-99 lines, ignoring general files
Projects
Status: Pending Review
Development

Successfully merging this pull request may close these issues.

3 participants