Skip to content

Commit b3c934c

Browse files
Fix BuildManifestBuilder.append_artifact to safely initialize artifact lists
1 parent 6eba98d commit b3c934c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/build_workflow/build_recorder.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ def append_component(self, name: str, version: str, repository_url: str, ref: st
8686

8787
def append_artifact(self, component: str, type: str, path: str) -> None:
8888
artifacts = self.components_hash[component]["artifacts"]
89-
list = artifacts.get(type, [])
90-
if len(list) == 0:
91-
artifacts[type] = list
92-
list.append(path)
89+
if type not in artifacts or not isinstance(artifacts[type], list):
90+
artifacts[type] = []
91+
artifacts[type].append(path)
9392

9493
def to_manifest(self) -> 'BuildManifest':
9594
# The build manifest expects `components` to be a list, not a hash, so we need to munge things a bit

0 commit comments

Comments
 (0)