Skip to content

Commit

Permalink
Guard set_repository_id during restore (#4315)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Jan 5, 2025
1 parent 284da50 commit 3959b60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/hacs/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,13 @@ def async_restore_repository(self, entry: str, repository_data: dict[str, Any]):
if not repository:
return

try:
self.hacs.repositories.set_repository_id(repository, entry)
except ValueError as exception:
self.logger.warning("<HacsData async_restore_repository> duplicate IDs %s", exception)
return

# Restore repository attributes
self.hacs.repositories.set_repository_id(repository, entry)
repository.data.authors = repository_data.get("authors", [])
repository.data.description = repository_data.get("description", "")
repository.data.downloads = repository_data.get("downloads", 0)
Expand Down

0 comments on commit 3959b60

Please sign in to comment.