From 0595e8fb6769fd9c47809a4c2102665f1ecb2cf3 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sat, 23 Dec 2023 22:58:14 +0100 Subject: [PATCH] fix(homepage): try adding more sanitasion for type (#648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- library/common/Chart.yaml | 2 +- .../common/templates/lib/ingress/integrations/_homepage.tpl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index b8e443fe7..7fd4ce978 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 16.2.18 +version: 16.2.19 diff --git a/library/common/templates/lib/ingress/integrations/_homepage.tpl b/library/common/templates/lib/ingress/integrations/_homepage.tpl index 5331801f4..0b5a25a36 100644 --- a/library/common/templates/lib/ingress/integrations/_homepage.tpl +++ b/library/common/templates/lib/ingress/integrations/_homepage.tpl @@ -14,7 +14,8 @@ {{- $name := $homepage.name | default ($rootCtx.Chart.Name | camelcase) -}} {{- $desc := $homepage.description | default $rootCtx.Chart.Description -}} {{- $icon := $homepage.icon | default $rootCtx.Chart.Icon -}} - {{- $type := $homepage.widget.type | default $rootCtx.Chart.Name -}} + {{- $type := ( $homepage.widget.type | default $rootCtx.Chart.Name ) | lower -}} + {{- $type = regexReplaceAll "\\W+" $type "" -}} {{- $url := $homepage.widget.url -}} {{- $href := $homepage.href -}} @@ -30,7 +31,7 @@ {{- if not $url -}} {{- $svc := $svcData.name -}} {{- $port := $svcData.port -}} - {{- $ns := printf "%s" (include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Ingress") -}} + {{- $ns := printf "%s" (include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $rootCtx "objectData" $objectData "caller" "Ingress")) -}} {{- $url = printf "http://%s.$ns.svc:%s" $svc $ns $port -}} {{- end -}}