Skip to content

Commit

Permalink
fix: deduped assume parent is a list
Browse files Browse the repository at this point in the history
* this enforces if parent is not a list to be treated as a list
  • Loading branch information
utnapischtim committed Jul 5, 2024
1 parent d6133f8 commit 5044622
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions invenio_records_lom/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def deduped_append(self, parent_key: str, value: Any):
"""Append `value` to `self.record[key]` if not already appended."""
self.record.setdefault(parent_key, [])
parent = self.record[parent_key]

if not isinstance(parent, list):
parent = [parent]

if value not in parent:
parent.append(value)

Expand Down

0 comments on commit 5044622

Please sign in to comment.