From 5695493307ef251ce397165160a026270b52cb63 Mon Sep 17 00:00:00 2001 From: kentsanggds Date: Thu, 21 Nov 2024 16:28:12 +0000 Subject: [PATCH 1/3] Use dominate.util.raw to prevent encoding link icons --- ckanext/datagovuk/ckan_patches/helpers.py | 21 +++++++++++++++++++++ ckanext/datagovuk/plugin.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ckanext/datagovuk/ckan_patches/helpers.py diff --git a/ckanext/datagovuk/ckan_patches/helpers.py b/ckanext/datagovuk/ckan_patches/helpers.py new file mode 100644 index 00000000..464e92ac --- /dev/null +++ b/ckanext/datagovuk/ckan_patches/helpers.py @@ -0,0 +1,21 @@ +import dominate +import dominate.tags as dom_tags +from markupsafe import Markup, escape +from typing import Any + +from ckan.lib.helpers import _preprocess_dom_attrs, literal, core_helper + + +@core_helper +def link_to(label: str, url: str, **attrs: Any) -> Markup: + attrs = _preprocess_dom_attrs(attrs) + attrs['href'] = url + if label == '' or label is None: + label = url + + # without dominate.util.raw the returned literal has encoding within it + return literal(dom_tags.a(dominate.util.raw(label), **attrs)) + + +import ckan.lib.helpers +ckan.lib.helpers.link_to = link_to diff --git a/ckanext/datagovuk/plugin.py b/ckanext/datagovuk/plugin.py index ee1e008e..20d7ba17 100644 --- a/ckanext/datagovuk/plugin.py +++ b/ckanext/datagovuk/plugin.py @@ -259,7 +259,7 @@ def dgu_home(): return bp # import these for monkey patching - from ckanext.datagovuk.ckan_patches import cli, logic, query + from ckanext.datagovuk.ckan_patches import cli, logic, query, helpers # ITemplateHelpers From 1a3b1ade1c22d07e29a54af32625a23a69f120e6 Mon Sep 17 00:00:00 2001 From: kentsanggds Date: Thu, 21 Nov 2024 16:39:15 +0000 Subject: [PATCH 2/3] Fix build_push_test_ckan BUILD_TAGS --- .github/workflows/build-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 739d2cb7..be512aeb 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -120,7 +120,7 @@ jobs: ;; "build_push_test_ckan") - echo "BUILD_TAGS=${{ matrix.app.version }}-test-d" >> $GITHUB_ENV + echo "BUILD_TAGS=${{ matrix.app.version }}-test" >> $GITHUB_ENV echo "DOCKERFILE=${{ matrix.app.version }}" >> $GITHUB_ENV echo "BUILD_CKAN_BASE=true" >> $GITHUB_ENV echo "ADD_PATCH_TAG=true" >> $GITHUB_ENV From 9f8da689edc88284d983d8518a50407627c97aa8 Mon Sep 17 00:00:00 2001 From: kentsanggds Date: Thu, 21 Nov 2024 16:50:38 +0000 Subject: [PATCH 3/3] Update CKAN patch version --- build-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-config.yaml b/build-config.yaml index 02356076..5f13c9c6 100644 --- a/build-config.yaml +++ b/build-config.yaml @@ -2,7 +2,7 @@ apps: ckan: &app_ckan name: ckan version: "2.10.4" - patch: g + patch: h pycsw: &app_pycsw name: pycsw version: "2.6.1"