diff --git a/src/build_workflow/build_recorder.py b/src/build_workflow/build_recorder.py index cb4cc38ef9..6be3503647 100644 --- a/src/build_workflow/build_recorder.py +++ b/src/build_workflow/build_recorder.py @@ -86,10 +86,9 @@ def append_component(self, name: str, version: str, repository_url: str, ref: st def append_artifact(self, component: str, type: str, path: str) -> None: artifacts = self.components_hash[component]["artifacts"] - list = artifacts.get(type, []) - if len(list) == 0: - artifacts[type] = list - list.append(path) + if type not in artifacts or not isinstance(artifacts[type], list): + artifacts[type] = [] + artifacts[type].append(path) def to_manifest(self) -> 'BuildManifest': # The build manifest expects `components` to be a list, not a hash, so we need to munge things a bit