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

Replace ast.literal_eval with json.loads for creator and publish attributes to avoid crashes on Unreal #91

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/ayon_unreal/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import collections
import sys
import six
import json
from abc import (
ABC,
ABCMeta,
Expand Down Expand Up @@ -77,9 +78,9 @@ def _default_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(
instance['creator_attributes'] = json.loads(
instance.get('creator_attributes', '{}'))
instance['publish_attributes'] = ast.literal_eval(
instance['publish_attributes'] = json.loads(
instance.get('publish_attributes', '{}'))
instance['members'] = ast.literal_eval(
instance.get('members', '[]'))
Expand Down