From d382c46443f281047193c5f43c698397ec066355 Mon Sep 17 00:00:00 2001 From: Timothy Mugo Date: Fri, 11 Sep 2026 09:57:24 +0300 Subject: [PATCH] chore: Update WordPress runtime version and improve safe decoding for special symbols in tooltip components --- Dockerfile | 2 +- .../blocks/format-bar/infotooltip.js | 14 +++++++++++--- .../blocks/format-bar/references.js | 14 +++++++++++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10fdac703..628223c24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ RUN mkdir -p wp-content/plugins \ RUN chown -R 82:82 wp-content \ && tar -caf /wp-content.tgz --exclude="**/node_modules" wp-content -FROM wordpress:7.0.2-fpm-alpine AS runtime +FROM wordpress:7.1.0-fpm-alpine AS runtime LABEL org.opencontainers.image.description="WordPress image for Data Viz" LABEL org.opencontainers.image.authors="Development Gateway " LABEL org.opencontainers.image.url="https://github.com/devgateway/data-viz-wordpress" diff --git a/plugins/wp-react-blocks-plugin/blocks/format-bar/infotooltip.js b/plugins/wp-react-blocks-plugin/blocks/format-bar/infotooltip.js index 72d39a549..566fa8bb9 100644 --- a/plugins/wp-react-blocks-plugin/blocks/format-bar/infotooltip.js +++ b/plugins/wp-react-blocks-plugin/blocks/format-bar/infotooltip.js @@ -14,6 +14,14 @@ import {info as linkIcon} from '@wordpress/icons'; import {Button, Modal, Panel, PanelBody, PanelRow, Popover, TextareaControl} from '@wordpress/components'; import { BLOCKS_NS } from '@devgateway/dvz-wp-commons'; +function safeDecodeURIComponent(text) { + try { + return decodeURIComponent(text); + } catch (e) { + return text; + } +} + const name = BLOCKS_NS + '/info-tooltip'; const reference = { name, @@ -35,7 +43,7 @@ const PopUI = ({onClose, onCancel}) => { return onCancel()}> setText(encodeURIComponent(value))} /> @@ -91,8 +99,8 @@ function InlineUI({value, onChange, activeObjectAttributes, contentRef, onClose} setContent(content)} + value={safeDecodeURIComponent(content)} + onChange={(newValue) => setContent(encodeURIComponent(newValue))} /> diff --git a/plugins/wp-react-blocks-plugin/blocks/format-bar/references.js b/plugins/wp-react-blocks-plugin/blocks/format-bar/references.js index 74923fcf4..f5789b13d 100644 --- a/plugins/wp-react-blocks-plugin/blocks/format-bar/references.js +++ b/plugins/wp-react-blocks-plugin/blocks/format-bar/references.js @@ -28,6 +28,14 @@ import { SelectControl } from '@wordpress/components'; +function safeDecodeURIComponent(text) { + try { + return decodeURIComponent(text); + } catch (e) { + return text; + } +} + const name = BLOCKS_NS + '/reference'; const reference = { name, @@ -81,7 +89,7 @@ const PopUI = ({onClose, onCancel, value}) => { setText(encodeURIComponent(value))} /> setContent(content)} + value={safeDecodeURIComponent(content)} + onChange={(newValue) => setContent(encodeURIComponent(newValue))} />