From 3bdbd089c9c948c87ed668b885537527a1a5e077 Mon Sep 17 00:00:00 2001 From: Nisha K Date: Thu, 9 Dec 2021 14:24:31 -0800 Subject: [PATCH] formats: Modify layer title based on manifest This is work towards #948 The html formatting of lists allows for an expansion UI under the title of the layer object. The title is the layer tarball's digest. In the Docker image layout, this can be directly taken from the "tar_file" key. But in the OCI layout, this value is taken from the "digest" key. This commit allows for that difference and defaults to the layer's index if neither one of those keys exist. Signed-off-by: Nisha K --- tern/formats/html/generator.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tern/formats/html/generator.py b/tern/formats/html/generator.py index 542b3565..47998e2c 100644 --- a/tern/formats/html/generator.py +++ b/tern/formats/html/generator.py @@ -148,12 +148,20 @@ def manifest_handler(list_obj, indent): def layers_handler(list_obj, indent): - '''Write html code for the origins list in the report + '''Write html code for the layers list in the report with tar_file hash as title''' html_string = ' '*indent + ' \n'