diff --git a/swh/web/common/service.py b/swh/web/common/service.py --- a/swh/web/common/service.py +++ b/swh/web/common/service.py @@ -1046,12 +1046,22 @@ A dict filled with the snapshot content. """ snapshot_id_bin = _to_sha1_bin(snapshot_id) + # not actually a snapshot, it's a dict with branches and a "next_branch" value. snapshot = storage.snapshot_get_branches( snapshot_id_bin, branches_from.encode(), branches_count, target_types ) if not snapshot: raise NotFoundExc("Snapshot with id %s not found!" % snapshot_id) - return converters.from_snapshot(snapshot) + return converters.from_snapshot( + { + "id": snapshot["id"], + "branches": { + branch_name: branch.to_dict() if branch else None + for (branch_name, branch) in snapshot["branches"].items() + }, + "next_branch": snapshot["next_branch"], + } + ) def lookup_latest_origin_snapshot( diff --git a/swh/web/tests/conftest.py b/swh/web/tests/conftest.py --- a/swh/web/tests/conftest.py +++ b/swh/web/tests/conftest.py @@ -298,7 +298,16 @@ branches_count, target_types, ) - return converters.from_snapshot(snp) + return converters.from_snapshot( + { + "id": snp["id"], + "branches": { + branch_name: branch.to_dict() + for (branch_name, branch) in snp["branches"].items() + }, + "next_branch": None, + } + ) def snapshot_get_head(self, snapshot): if snapshot["branches"]["HEAD"]["target_type"] == "alias":