From 790770aef38ca9bf368f9785a984f90089867d4c Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Tue, 27 Sep 2022 17:10:19 +0200 Subject: [PATCH] Fix empty container layer history and UI (#21251) (#21278) Backport of #21251 --- modules/packages/container/metadata.go | 4 +++- templates/package/content/container.tmpl | 4 ++-- web_src/less/_package.less | 9 +++++++++ web_src/less/index.less | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 web_src/less/_package.less diff --git a/modules/packages/container/metadata.go b/modules/packages/container/metadata.go index 4222cdb30a..fd38e67859 100644 --- a/modules/packages/container/metadata.go +++ b/modules/packages/container/metadata.go @@ -95,7 +95,9 @@ func parseOCIImageConfig(r io.Reader) (*Metadata, error) { if i := strings.Index(cmd, "#(nop) "); i != -1 { cmd = strings.TrimSpace(cmd[i+7:]) } - imageLayers = append(imageLayers, cmd) + if cmd != "" { + imageLayers = append(imageLayers, cmd) + } } metadata := &Metadata{ diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl index 14d4a56398..22bd50b042 100644 --- a/templates/package/content/container.tmpl +++ b/templates/package/content/container.tmpl @@ -43,7 +43,7 @@ {{if .PackageDescriptor.Metadata.ImageLayers}}

{{.i18n.Tr "packages.container.layers"}}

- +
{{range .PackageDescriptor.Metadata.ImageLayers}} @@ -57,7 +57,7 @@ {{if .PackageDescriptor.Metadata.Labels}}

{{.i18n.Tr "packages.container.labels"}}

-
+
diff --git a/web_src/less/_package.less b/web_src/less/_package.less new file mode 100644 index 0000000000..f4a07a1889 --- /dev/null +++ b/web_src/less/_package.less @@ -0,0 +1,9 @@ +.container-labels { + td:nth-child(1) { + vertical-align: top; + } + + td:nth-child(2) { + overflow-wrap: anywhere; + } +} diff --git a/web_src/less/index.less b/web_src/less/index.less index 4a6bd330fe..8bdd2f564a 100644 --- a/web_src/less/index.less +++ b/web_src/less/index.less @@ -34,5 +34,6 @@ @import "_admin"; @import "_explore"; @import "_review"; +@import "_package"; @import "./helpers.less";
{{.i18n.Tr "packages.container.labels.key"}}