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
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
7 changes: 4 additions & 3 deletions openpype/hosts/unreal/api/plugin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import ast
import collections
import sys
import six
import json
from abc import (
ABC,
ABCMeta,
Expand Down Expand Up @@ -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)

instance['creator_attributes'] = json.loads(
instance.get('creator_attributes', '{}'))
instance['publish_attributes'] = ast.literal_eval(
instance['publish_attributes'] = json.loads(
instance.get('publish_attributes', '{}'))
created_instance = CreatedInstance.from_existing(instance, self)
self._add_instance_to_context(created_instance)
Expand Down
Loading