diff --git a/swh/web/browse/snapshot_context.py b/swh/web/browse/snapshot_context.py --- a/swh/web/browse/snapshot_context.py +++ b/swh/web/browse/snapshot_context.py @@ -480,7 +480,7 @@ ) visit_url = reverse("browse-origin-directory", query_params=query_params) - visit_info["url"] = visit_url + visit_info["url"] = directory_url = visit_url branches_url = reverse("browse-origin-branches", query_params=query_params) @@ -489,6 +489,7 @@ assert snapshot_id is not None branches, releases, aliases = get_snapshot_content(snapshot_id) url_args = {"snapshot_id": snapshot_id} + directory_url = reverse("browse-snapshot-directory", url_args=url_args) branches_url = reverse("browse-snapshot-branches", url_args=url_args) releases_url = reverse("browse-snapshot-releases", url_args=url_args) @@ -611,6 +612,7 @@ revision_info["message_header"] = "" snapshot_context = SnapshotContext( + directory_url=directory_url, branch=branch_name, branch_alias=branch_name in aliases, branches=branches, diff --git a/swh/web/common/typing.py b/swh/web/common/typing.py --- a/swh/web/common/typing.py +++ b/swh/web/common/typing.py @@ -131,6 +131,8 @@ """common URL arguments when browsing snapshot content""" visit_info: Optional[OriginVisitInfo] """optional origin visit info associated to the snapshot""" + directory_url: Optional[str] + """optional root directory URL associated to the snapshot""" class SWHObjectInfo(TypedDict): diff --git a/swh/web/templates/includes/snapshot-context.html b/swh/web/templates/includes/snapshot-context.html --- a/swh/web/templates/includes/snapshot-context.html +++ b/swh/web/templates/includes/snapshot-context.html @@ -37,7 +37,7 @@