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 @@ -823,13 +823,15 @@ swh_objects = [] vault_cooking = {} - revision_found = True + revision_found = False if sha1_git is None and revision_id is not None: try: archive.lookup_revision(revision_id) except NotFoundExc: - revision_found = False + pass + else: + revision_found = True if sha1_git is not None: swh_objects.append( diff --git a/swh/web/tests/browse/views/test_snapshot.py b/swh/web/tests/browse/views/test_snapshot.py --- a/swh/web/tests/browse/views/test_snapshot.py +++ b/swh/web/tests/browse/views/test_snapshot.py @@ -363,9 +363,20 @@ ) archive_data.snapshot_add([snapshot]) - url = reverse("browse-snapshot-log", url_args={"snapshot_id": snapshot.id.hex()}) + snp_url = reverse( + "browse-snapshot-directory", url_args={"snapshot_id": snapshot.id.hex()} + ) + log_url = reverse( + "browse-snapshot-log", url_args={"snapshot_id": snapshot.id.hex()} + ) + + resp = check_html_get_response( + client, snp_url, status_code=200, template_used="browse/directory.html" + ) + assert_not_contains(resp, log_url) + resp = check_html_get_response( - client, url, status_code=404, template_used="error.html" + client, log_url, status_code=404, template_used="error.html" ) assert_contains( resp,